feat: ReferenceLine + ReferenceArea annotation parts#9
Open
DloomPlz wants to merge 1 commit into
Open
Conversation
Two composable annotation parts for the cartesian charts, rendered in the front SVG layer with the same shadcn theme tokens as the rest of the chrome: - <ReferenceLine value label? tone? variant dashed?> — a horizontal line at a y-value with an optional right-aligned label pill. quiet (muted hairline + popover pill, for readouts like hover min/max) or solid (seed-toned, for hard limits like a liquidation price). Hidden when the value falls outside the y-domain. - <ReferenceArea x1? x2? y1? y2? tone? label?> — a low-alpha band; x edges are row indices (vertical band, e.g. an outage window), y edges are domain values (horizontal band, e.g. a danger zone); omitted edges span the plot. Both ship in core (chrome). Registry JSON regenerated via npm run build.
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.

Motivation
Real dashboards annotate: a liquidation price, a hover min/max readout, an outage window, a danger zone. Today each consumer rebuilds these as bespoke SVG overlays against the chart's mapping. These are the two primitives we kept reaching for while porting a DeFi dashboard onto the kit — generalized to the same shadcn theme tokens as the rest of the chrome.
What
Two composable front-SVG parts, shipped in
core:<ReferenceLine value={1.1} label="Liquidation 1.10" tone="red" variant="solid" />A horizontal line at a y-value with an optional right-aligned label pill.
quiet= muted hairline + popover-styled pill (readouts);solid= seed-toned line and pill (hard limits). Hidden automatically when the value is outside the y-domain, so hosts pass raw values without clamping.<ReferenceArea x1={18} x2={24} label="offline" />/<ReferenceArea y1={0} y2={1.1} tone="red" />A low-alpha band.
x1/x2are row indices (vertical band — outage/maintenance windows);y1/y2are domain values (horizontal band — threshold zones); omitted edges span the plot. With atonethe fill uses that seed at 8% alpha, otherwise a muted neutral.Pairs naturally with #6 (explicit/auto y-domains) but doesn't depend on it. Registry JSON regenerated via
npm run build; both parts exported from the index.