Repository navigation
Conversation
…e axis The chart wraps the legend below the plot onto as many rows as its entries need, and the grid's bottom inset was a fixed 60 px, which is room for one row. Every further row was drawn over the time labels and then over the curves: with ten curves, two rows at 1400 px covered the time axis and four or five at 590 px the bottom of the grid as well. The rows are now laid out before the chart is: each entry's text is measured on a canvas, as the chart measures it, and wrapped by the chart's own rule at the chart's width. One row keeps the 60 px inset; each further row adds 22 px, a row and its gap. An entry is taken a pixel or two wider than it is drawn, so the rows laid out are never fewer than the rows drawn. Rows that would take more than 35 % of the chart's height become one row that pages instead. The layout comes from the texts and the chart's size rather than from the drawn legend, so the first frame, a resize and a new live value all have it in the same render. The projection, the drawing overlay and the time band's hit-test read the same inset, and the projection is republished when it changes.
The user guide's Legend entry for Bottom says what happens to names that do not fit on one row: they wrap, the plot gives up the height, and past about a third of the plot they become one row with paging arrows.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sixth of six; based on [5/6] (
als/plot-layout-switches).The chart wraps the legend below the plot onto as many rows as its entries need, but the grid's bottom inset is a fixed 60 px, room for one row. Every further row is drawn over the time labels and then over the curves: with ten curves, two rows at 1400 px cover the time axis, and four or five at 590 px the bottom of the grid as well.
fix(trace): a legend that wraps below the plot stays clear of the time axis
docs(trace): the legend below the plot wraps and pages
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: 5194 tests pass (new cases inlegendLayout,plotOption.legendLayout).pnpm build,format:check: pass.pnpm test:e2e(the whole stack): 220 pass; the wrong-major styling case fails against this SDK pin and passes with feat(trace): an axis can drop its ruler and keep its traces #218's second commit plus an SDK build that includes canopy-sdk-js 8542754, as described in feat(trace): an axis can drop its ruler and keep its traces #218. New specs:side-legend,trace-focus-click,plot-layout-switches,bottom-legend.scripts/check-chrome-literals.mjsfails onsrc/workbench/fields/ColourSwatch.tsx:64(useState('#000000')), on ALS: Trace, Correlation and Waveform on one workbench #208's head as well; not touched here.