@netdata/charts
Version:
Netdata frontend SDK and chart utilities
43 lines (42 loc) • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _default = exports["default"] = function _default(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);
});
};