Add plot legend with floating top-right overlay

Renders a small panel inside the plot showing each visible series as [color swatch] [sensor title] [latest value + unit]. Panel width fits the longest sensor name and redraws when sensors are added or removed from the plot (RefreshPlotSeries already fires PlotInvalidated). Falls back to ellipsizing only if the label column would push the panel past the plot bounds. Capped at 12 rows with a +N more footer; auto-hides when plot pane is narrower than 200px. Theme-aware translucent background + border match the plot frame.

Persisted as showPlotLegend (default true) and toggleable from View menu and plot context menu. The View menu item is hidden when ShowPlot is off, but the setting itself is preserved across plot enable/disable and app restarts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-06-02 14:26:11 -05:00
co-authored by Copilot
parent ac65b63a8f
commit 73a81138a7
3 changed files with 177 additions and 0 deletions
@@ -43,6 +43,9 @@
<MenuFlyoutSeparator />
<ToggleMenuFlyoutItem Text="Show Hidden Sensors" IsChecked="{x:Bind ViewModel.ShowHiddenSensors, Mode=TwoWay}" />
<ToggleMenuFlyoutItem Text="Show Plot" IsChecked="{x:Bind ViewModel.ShowPlot, Mode=TwoWay}" />
<ToggleMenuFlyoutItem Text="Show Plot Legend"
IsChecked="{x:Bind ViewModel.ShowPlotLegend, Mode=TwoWay}"
Visibility="{x:Bind ViewModel.ShowPlotLegendMenuVisibility, Mode=OneWay}" />
<ToggleMenuFlyoutItem Text="Gadget" IsChecked="{x:Bind ViewModel.ShowGadget, Mode=TwoWay}" />
<MenuFlyoutSubItem Text="Columns">
<ToggleMenuFlyoutItem Text="Value" IsChecked="{x:Bind ViewModel.ShowValueColumn, Mode=TwoWay}" />