UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

37 lines 1.25 kB
export default (function (sdk) { return sdk.on("highlightHover", function (chart, dimensionX, dimensionY) { chart.getApplicableNodes({ syncHover: true }).forEach(function (node) { return node.updateAttribute("hoverX", [dimensionX, dimensionY]); }); }).on("highlightBlur", function (chart) { chart.getApplicableNodes({ syncHover: true }).forEach(function (node) { return node.updateAttribute("hoverX", null); }); }).on("hoverChart", function (chart) { chart.getApplicableNodes({ syncHover: true }).forEach(function (node) { if (node.getAttribute("hovering") || chart.getRoot().getAttribute("paused")) return; node.updateAttributes({ hovering: true, renderedAt: chart.getAttribute("after") < 0 ? chart.getUI().getRenderedAt() : chart.getAttribute("before") * 1000 }); }); sdk.trigger("play:hoverChart", chart); }).on("blurChart", function (chart) { chart.getApplicableNodes({ syncHover: true }).forEach(function (node) { if (chart.getRoot().getAttribute("paused")) return; node.updateAttributes({ hovering: false, renderedAt: null }); }); sdk.trigger("play:blurChart", chart); }); });