@amcharts/amcharts5
Version:
amCharts 5
39 lines • 1.3 kB
JavaScript
import { Entity } from "../../../core/util/Entity";
import * as $object from "../../../core/util/Object";
/**
* Draws a bullet on an axis.
*
* @see {@link https://www.amcharts.com/docs/v5/charts/xy-chart/axes/#Axis_bullets} for more info
*/
export class AxisBullet extends Entity {
_beforeChanged() {
super._beforeChanged();
const sprite = this.get("sprite");
if (this.isDirty("sprite")) {
if (sprite) {
sprite._setCAll({ position: "absolute", role: "figure" });
this._disposers.push(sprite);
}
}
if (this.isDirty("location")) {
const dataItem = sprite.dataItem;
if (this.axis && sprite && dataItem) {
this.axis._prepareDataItem(dataItem);
}
}
}
_dispose() {
const axis = this.axis;
if (axis) {
$object.each(axis._bullets, (key, bullet) => {
if (bullet.uid == this.uid) {
delete axis._bullets[key];
}
});
}
super._dispose();
}
}
AxisBullet.className = "AxisBullet";
AxisBullet.classNames = Entity.classNames.concat([AxisBullet.className]);
//# sourceMappingURL=AxisBullet.js.map