UNPKG

devextreme

Version:

JavaScript/TypeScript Component Suite for Responsive Web Development

81 lines (80 loc) 2.66 kB
/** * DevExtreme (esm/__internal/viz/series/points/bubble_point.js) * Version: 25.2.5 * Build date: Fri Feb 20 2026 * * Copyright (c) 2012 - 2026 Developer Express Inc. ALL RIGHTS RESERVED * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/ */ import { extend } from "../../../../core/utils/extend"; import symbolPoint from "../../../viz/series/points/symbol_point"; const _extend = extend; const MIN_BUBBLE_HEIGHT = 20; export default _extend({}, symbolPoint, { correctCoordinates(diameter) { this.bubbleSize = diameter / 2 }, _drawMarker(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(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() { const formatObject = symbolPoint._getLabelFormatObject.call(this); formatObject.size = this.initialSize; return formatObject }, _updateData(data) { symbolPoint._updateData.call(this, data); this.size = this.initialSize = data.size }, _getGraphicBBox() { return this._getSymbolBBox(this.x, this.y, this.bubbleSize) }, _updateMarker(animationEnabled, style) { const that = this; if (!animationEnabled) { style = _extend({ r: that.bubbleSize, translateX: that.x, translateY: that.y }, style) } that.graphic.smartAttr(style) }, _getFormatObject(tooltip) { const formatObject = symbolPoint._getFormatObject.call(this, tooltip); formatObject.sizeText = tooltip.formatValue(this.initialSize); return formatObject }, _storeTrackerR() { return this.bubbleSize }, _getLabelCoords(label) { let coords; if ("inside" === label.getLayoutOptions().position) { coords = this._getLabelCoordOfPosition(label, "inside") } else { coords = symbolPoint._getLabelCoords.call(this, label) } return coords } });