devextreme
Version:
JavaScript/TypeScript Component Suite for Responsive Web Development
80 lines (78 loc) • 2.73 kB
JavaScript
/**
* DevExtreme (cjs/__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/
*/
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _utils = require("../../viz/core/utils");
var _base_range_container = _interopRequireWildcard(require("../../viz/gauges/base_range_container"));
function _interopRequireWildcard(e, t) {
if ("function" == typeof WeakMap) {
var r = new WeakMap,
n = new WeakMap
}
return (_interopRequireWildcard = function(e, t) {
if (!t && e && e.__esModule) {
return e
}
var o, i, f = {
__proto__: null,
default: e
};
if (null === e || "object" != typeof e && "function" != typeof e) {
return f
}
if (o = t ? n : r) {
if (o.has(e)) {
return o.get(e)
}
o.set(e, f)
}
for (const t in e) {
"default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t])
}
return f
})(e, t)
}
class CircularRangeContainer extends _base_range_container.default {
_processOptions() {
this._inner = 0;
this._outer = 0;
switch ((0, _utils.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 = (0, _base_range_container.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 = (0, _base_range_container.getMaxRangeWidth)(this._options.width);
return {
min: layout.radius - this._inner * width,
max: layout.radius + this._outer * width
}
}
}
var _default = exports.default = CircularRangeContainer;