devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
89 lines (87 loc) • 3.05 kB
JavaScript
/**
* DevExtreme (cjs/viz/series/points/bubble_point.js)
* Version: 24.2.6
* Build date: Mon Mar 17 2025
*
* Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
"use strict";
exports.default = void 0;
var _extend2 = require("../../../core/utils/extend");
var _symbol_point = _interopRequireDefault(require("./symbol_point"));
function _interopRequireDefault(e) {
return e && e.__esModule ? e : {
default: e
}
}
const _extend = _extend2.extend;
const MIN_BUBBLE_HEIGHT = 20;
var _default = exports.default = _extend({}, _symbol_point.default, {
correctCoordinates: function(diameter) {
this.bubbleSize = diameter / 2
},
_drawMarker: function(renderer, group, animationEnabled) {
const attr = _extend({
translateX: this.x,
translateY: this.y
}, this._getStyle());
this.graphic = renderer.circle(0, 0, animationEnabled ? 0 : this.bubbleSize).smartAttr(attr).data({
"chart-data-point": this
}).append(group)
},
getTooltipParams: function(location) {
const graphic = this.graphic;
if (!graphic) {
return
}
const height = graphic.getBBox().height;
return {
x: this.x,
y: this.y,
offset: height < 20 || "edge" === location ? height / 2 : 0
}
},
_getLabelFormatObject: function() {
const formatObject = _symbol_point.default._getLabelFormatObject.call(this);
formatObject.size = this.initialSize;
return formatObject
},
_updateData: function(data) {
_symbol_point.default._updateData.call(this, data);
this.size = this.initialSize = data.size
},
_getGraphicBBox: function() {
return this._getSymbolBBox(this.x, this.y, this.bubbleSize)
},
_updateMarker: function(animationEnabled, style) {
const that = this;
if (!animationEnabled) {
style = _extend({
r: that.bubbleSize,
translateX: that.x,
translateY: that.y
}, style)
}
that.graphic.smartAttr(style)
},
_getFormatObject: function(tooltip) {
const formatObject = _symbol_point.default._getFormatObject.call(this, tooltip);
formatObject.sizeText = tooltip.formatValue(this.initialSize);
return formatObject
},
_storeTrackerR: function() {
return this.bubbleSize
},
_getLabelCoords: function(label) {
let coords;
if ("inside" === label.getLayoutOptions().position) {
coords = this._getLabelCoordOfPosition(label, "inside")
} else {
coords = _symbol_point.default._getLabelCoords.call(this, label)
}
return coords
}
});
module.exports = exports.default;
module.exports.default = exports.default;