Skip to content

[5/6] feat(trace): Rulers and Legend from the plot's toolbar and right-click menu - #223

Open
thellert wants to merge 4 commits into
als/legend-focus-fixesfrom
als/plot-layout-switches
Open

thellert wants to merge 4 commits into
als/legend-focus-fixesfrom
als/plot-layout-switches

Conversation

@thellert

@thellert thellert commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Fifth of six; based on [4/6] (als/legend-focus-fixes).

Switching between one ruler and a ruler per axis, or moving the legend, meant opening Display in the Properties panel and finding the field under More. Both are things one changes while looking at the plot.

feat(trace): Rulers and Legend switch from the plot's toolbar

  • The bar with the time-range chips ends in two icon buttons, Rulers and Legend, wherever it is drawn: the tab bar, each plot of the grid, the fullscreen header and a detached window's title bar. Each opens a menu of its choices (All axes / Focused curve; Bottom / Side / Off) with the current one ticked; a pick writes that plot.
  • The buttons, the Properties fields and the plot= config go through one writer, withPlotLayout, run by the same workbench update as the fields, so the fields, the posted query and a saved view read one value. The choice labels live beside it and the fields list them from there.
  • The two buttons take 56 px. In a 590 px panel the bar keeps its controls whole and the tab titles give up the room, as they already do for the range chips.

feat(trace): Rulers and Legend switch from the plot's right-click menu

A right-click in the grid lists Rulers › (All axes / Focused curve) and Legend › (Bottom / Side / Off) after Reset zoom, each with the plot's current choice ticked, writing through the same withPlotLayout. The two entries are point actions of the shared menu registry in the view group, offered only when a tool wires their writers, so Waveform and Correlation are unchanged.

test(trace): rulers and legend switched from the toolbar and the right-click menu

A browser spec drives a three-curve plot through Rulers All → Focused → All and Legend Bottom → Side → Off → Bottom, once by the toolbar buttons and once by the right-click submenus. After each pick it counts the rulers drawn, finds the legend and reads rulers= and legend= from the query posted to the host. It also checks that the buttons toggle their menus, that the Properties fields read what the buttons wrote, and that in a 590 px panel the buttons and Add plot stay whole.

docs(trace): Rulers and Legend from the plot's buttons and right-click menu

Testing

On this branch's tip with #208's own SDK pin (0.3.1-als.1; the lockfile re-resolved locally, since #208's committed lockfile does not install frozen):

  • typecheck, lint: pass.
  • vitest run: 5167 tests pass (new cases in LayoutControls, plotView, menu, plot/menus, contextMenu/registry, TraceApp.rangeControlsSites).
  • scripts/check-chrome-literals.mjs fails on src/workbench/fields/ColourSwatch.tsx:64 (useState('#000000')), on ALS: Trace, Correlation and Waveform on one workbench #208's head as well; not touched here.

Switching between one ruler and a ruler per axis, or moving the legend,
meant opening Display in the Properties panel and finding the field under
More. The bar with the time-range chips now ends in two icon buttons,
Rulers and Legend, at every place it is drawn: the tab bar, each plot of
the grid, the fullscreen header and a detached window's title bar. Each
opens a menu of its setting's choices (All axes / Focused curve; Bottom /
Side / Off) with the current one ticked, and a pick writes that plot.

The buttons, the Properties fields and the plot= config go through one
writer, withPlotLayout, run by the same workbench update as the fields,
so the fields, the posted query and a saved view read one value. The
choice names live beside it and the fields list them from there. Rulers
is still stored only as "focus", the legend through withLegendPlacement.

The two buttons take 56 px. In a 590 px panel the bar keeps its controls
whole and the tab titles give up the room, as they already did for the
range chips.
A right-click in the grid now lists Rulers › (All axes / Focused curve)
and Legend › (Bottom / Side / Off) after Reset zoom, each submenu with the
plot's current choice ticked. A pick writes through the same
withPlotLayout update as the toolbar buttons and the Properties fields;
picking the current choice writes nothing.

The two entries are point actions of the shared menu registry, placed in
the view group and offered only when a tool wires their writers, so
Waveform and Correlation are unchanged.
…t-click menu

A browser spec drives a three-curve plot through Rulers All → Focused →
All and Legend Bottom → Side → Off → Bottom, once with the toolbar buttons
and once with the right-click submenus. After each pick it counts the
rulers drawn, finds the legend (the table beside or below the plot, or the
chart's own legend under the grid) and reads the query posted to the host
for rulers= and legend=. It also checks that a second click on a button
closes its menu and a third opens it, that the Properties fields read what
the buttons wrote, and that in a 590 px panel the buttons and Add plot stay
whole in the tab bar and still work.
…k menu

The user guide says, where Legend and the ruler settings are described,
that both can be switched from the buttons above the plot and from the
right-click menu, and that these set the same field as Display. The
right-click list in the workbench page names the two submenus Trace adds.
@thellert
thellert requested a review from a team as a code owner December 3, 2026 01:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant