Plot fix
This commit is contained in:
@@ -1024,6 +1024,13 @@ body {
|
|||||||
.chart-area .u-legend { color: #94a3b8; font-size: 0.75rem; }
|
.chart-area .u-legend { color: #94a3b8; font-size: 0.75rem; }
|
||||||
.chart-area .u-value { color: #e2e8f0; }
|
.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 ──────────────────────────────────────────────────── */
|
||||||
|
|
||||||
.edit-mode-layout {
|
.edit-mode-layout {
|
||||||
|
|||||||
@@ -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.
|
// Stable primitive deps so the effect re-runs when plotType or signals change.
|
||||||
const timeRangeKey = timeRange ? `${timeRange.start}|${timeRange.end}` : 'live';
|
const timeRangeKey = timeRange ? `${timeRange.start}|${timeRange.end}` : 'live';
|
||||||
const plotType = widget.options['plotType'] ?? 'timeseries';
|
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(',');
|
const signalsKey = widget.signals.map(s => `${s.ds}:${s.name}${s.color ?? ''}`).join(',');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -436,7 +437,7 @@ export default function PlotWidget({ widget, onContextMenu, timeRange }: Props)
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class="plot-widget"
|
class={`plot-widget legend-${legendPos}`}
|
||||||
ref={outerRef}
|
ref={outerRef}
|
||||||
style={`left:${widget.x}px;top:${widget.y}px;width:${widget.w}px;height:${widget.h}px;`}
|
style={`left:${widget.x}px;top:${widget.y}px;width:${widget.w}px;height:${widget.h}px;`}
|
||||||
onContextMenu={onContextMenu}
|
onContextMenu={onContextMenu}
|
||||||
|
|||||||
Reference in New Issue
Block a user