This commit is contained in:
Martino Ferrari
2026-06-19 07:57:42 +02:00
parent ba836f00e6
commit 914108e575
2 changed files with 9 additions and 1 deletions
+7
View File
@@ -1024,6 +1024,13 @@ body {
.chart-area .u-legend { color: #94a3b8; font-size: 0.75rem; }
.chart-area .u-value { color: #e2e8f0; }
/* Legend position for the uPlot (timeseries) chart. uPlot always renders its
legend below the canvas, so to honour "top" we make the chart root a flex
column and reorder the legend above the plot. ECharts plots position their
own legend internally (see echartsOption), so these rules don't apply there. */
.plot-widget.legend-top .chart-area .uplot { display: flex; flex-direction: column; }
.plot-widget.legend-top .chart-area .u-legend { order: -1; }
/* ── Edit Mode layout ──────────────────────────────────────────────────── */
.edit-mode-layout {
+2 -1
View File
@@ -70,6 +70,7 @@ export default function PlotWidget({ widget, onContextMenu, timeRange }: Props)
// Stable primitive deps so the effect re-runs when plotType or signals change.
const timeRangeKey = timeRange ? `${timeRange.start}|${timeRange.end}` : 'live';
const plotType = widget.options['plotType'] ?? 'timeseries';
const legendPos = widget.options['legend'] ?? 'bottom';
const signalsKey = widget.signals.map(s => `${s.ds}:${s.name}${s.color ?? ''}`).join(',');
useEffect(() => {
@@ -436,7 +437,7 @@ export default function PlotWidget({ widget, onContextMenu, timeRange }: Props)
return (
<div
class="plot-widget"
class={`plot-widget legend-${legendPos}`}
ref={outerRef}
style={`left:${widget.x}px;top:${widget.y}px;width:${widget.w}px;height:${widget.h}px;`}
onContextMenu={onContextMenu}