Legend export: restyle the band in the app's theme - #498
Merged
Merged
Conversation
Draw the band on a plain white surface in the theme's typeface, ink and hairline colors, read off :root per export, with the theme's font weights loaded before drawing. The header prints each date as a small label over its value, and on a wide export takes a column of its own to the left of the rows, sized to its text up to a quarter of the band, with more clear space beside a shorter header. Pale swatches and ramp ends get a hairline edge so they don't vanish against the white.
CarsonDavis
approved these changes
Sep 25, 2026
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.
Line breakdown
This PR restyles the legend band under an exported map so it reads as part of the dashboard rather than a generic grey panel: the app theme's typeface and colors on a plain white surface, a header that sits beside the rows on a wide export, and dates set as a small label over their value.
Part of #328
What this does
bandTheme.tsreads the typeface, ink, muted and hairline colors and the font weights off:rootonce per export, falling back per token to Public Sans and USWDS-like greys. The surface stays white regardless of theme, since the export is a printable artifact. Each weight is loaded withdocument.fonts.loadbefore drawing, because a canvas silently substitutes a fallback face for a web font the page hasn't used yet.headerFacts: { label, value }[]instead of pre-wordedheaderLines, and each prints as a small muted label (Time cursor,Exported) over its value.Decisions to review
Test plan
npx vitest run: all 3079 pass. The legend suite (55) covers the column sizing between a short and a capped header, header wrapping and ellipsis, and the measure and draw passes agreeing on the band's height in stacked, columned and wrapped layouts.Note: a mission whose Time Format holds a moment-style pattern such as
YYYY-MM-DDTHH:mm:ss[Z]prints that pattern literally in the header, because the format is d3-only. Set it to%Y-%m-%dT%H:%M:%SZor clear it.