@amcharts/amcharts5
Version:
amCharts 5
48 lines • 1.61 kB
JavaScript
import { HierarchyNode } from "./HierarchyNode";
import * as $array from "../../core/util/Array";
/**
* A node class for [[LinkedHierarchy]].
*/
export class LinkedHierarchyNode extends HierarchyNode {
_afterNew() {
super._afterNew();
this.states.create("disabled", {});
this.states.create("hover", {});
this.states.create("hoverDisabled", {});
}
_updateLinks(duration) {
const dataItem = this.dataItem;
if (dataItem) {
let links = dataItem.get("links");
$array.each(links, (link) => {
let source = link.get("source");
let target = link.get("target");
if (source && target) {
if (source.get("node").isHidden() || target.get("node").isHidden()) {
link.hide(duration);
}
else {
link.show(duration);
}
}
});
}
}
_prepareChildren() {
super._prepareChildren();
if (this.isDirty("disabled")) {
this._updateLinks();
}
}
_onHide(duration) {
super._onHide(duration);
this._updateLinks(duration);
}
_onShow(duration) {
super._onShow(duration);
this._updateLinks(duration);
}
}
LinkedHierarchyNode.className = "LinkedHierarchyNode";
LinkedHierarchyNode.classNames = HierarchyNode.classNames.concat([LinkedHierarchyNode.className]);
//# sourceMappingURL=LinkedHierarchyNode.js.map