devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
50 lines (49 loc) • 1.68 kB
JavaScript
/**
* DevExtreme (esm/__internal/viz/gauges/circular_range_container.js)
* Version: 26.1.6
* Build date: Fri Oct 16 2026
*
* Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
import {
normalizeEnum
} from "../../viz/core/utils";
import BaseRangeContainer, {
getMaxRangeWidth
} from "../../viz/gauges/base_range_container";
class CircularRangeContainer extends BaseRangeContainer {
_processOptions() {
this._inner = 0;
this._outer = 0;
switch (normalizeEnum(this._options.orientation)) {
case "inside":
this._inner = 1;
break;
case "center":
this._inner = .5;
this._outer = .5;
break;
default:
this._outer = 1
}
}
_isVisible(layout) {
const width = getMaxRangeWidth(this._options.width);
return layout.radius - this._inner * width > 0
}
_createRange(range, layout) {
const width = (range.startWidth + range.endWidth) / 2;
return this._renderer.arc(layout.x, layout.y, layout.radius - this._inner * width, layout.radius + this._outer * width, this._translator.translate(range.end), this._translator.translate(range.start)).attr({
"stroke-linejoin": "round"
})
}
measure(layout) {
const width = getMaxRangeWidth(this._options.width);
return {
min: layout.radius - this._inner * width,
max: layout.radius + this._outer * width
}
}
}
export default CircularRangeContainer;