add plot cursor sync to nodelist rows

This commit is contained in:
Christoph Kluge
2025-11-12 16:44:49 +01:00
parent fb278182d3
commit f56783a439
3 changed files with 26 additions and 6 deletions

View File

@@ -39,7 +39,7 @@
yunit = "",
title = "",
forResources = false,
plotSync,
plotSync = null,
} = $props();
/* Const Init */
@@ -204,11 +204,7 @@
live: true,
},
cursor: {
drag: { x: true, y: true },
sync: {
key: plotSync.key,
scales: ["x", null],
}
drag: { x: true, y: true }
}
};
@@ -293,6 +289,14 @@
if (!uplot) {
opts.width = ren_width;
opts.height = ren_height;
if (plotSync) {
opts.cursor.sync = {
key: plotSync.key,
scales: ["x", null],
}
}
uplot = new uPlot(opts, data, plotWrapper); // Data is uplot formatted [[X][Ymin][Yavg][Ymax]]
plotSync.sub(uplot)
} else {

View File

@@ -48,6 +48,7 @@
zoomState = null,
thresholdState = null,
extendedLegendData = null,
plotSync = null,
onZoom
} = $props();
@@ -576,6 +577,14 @@
if (!uplot) {
opts.width = ren_width;
opts.height = ren_height;
if (plotSync) {
opts.cursor.sync = {
key: plotSync.key,
scales: ["x", null],
}
}
if (zoomState && metricConfig?.aggregation == "avg") {
opts.scales = {...zoomState}
} else if (zoomState && metricConfig?.aggregation == "sum") {
@@ -584,6 +593,7 @@
if ((thresholdState === thresholds?.normal)) { opts.scales = {...zoomState} };
} // else: reset scaling to default
}
uplot = new uPlot(opts, plotData, plotWrapper);
} else {
uplot.setSize({ width: ren_width, height: ren_height });