Files
CatoandClaude Opus 5.5 aa1eb85f6c feat(chartkit): LineExplorer — a chart the reader works; numbers shown with every value a link (#5)
* feat(chartkit): LineExplorer — a chart the reader works; numbers shown with every value a link

- @bitbaum/chartkit/explore: LineExplorer ("use client") over LineChart.
  Toggle series (never the last), narrow periods, figures or change since
  the first period; the view is data the app keeps in its URL
  (initial / onViewChange). Every control 44px, every word from the app.
- LineChart `numbers`: the table behind the chart shown behind a
  disclosure, each value a link to its source. Hidden table stays text.
- TableCell can be { text, href }. LineSeries.colour keeps a colour stable.
- Browser test works the explorer at 390/1280, light/dark: toggles,
  range, change from 0, table links, 44px targets, no overflow, audit.

First of Solon's "every number clickable, slice and dice" phases; upstream
so every product gets it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(chatkit): the reader's place is where it was when history loads, not a fixed 240px

The Messenger check failed on main every run (325px): loading starts 200px
before the top (the observer's margin), so where the reader stands when the
page arrives varies. Measure the first message before and after the load;
a lost place still fails (it would jump down a whole page, off screen).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(chartkit): the explorer's figures/change switch reads as a choice, not as switched off

The unchosen option was drawn muted, like a series switched off. It is a
choice of two: the chosen one is filled, the other reads as any button.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(chartkit): LineExplorer defaultView — the app's own start, what Reset returns to

A product that keeps a series off until asked for (a second grey median)
showed Reset on first load. defaultView is the starting view: Reset returns
to it and only a departure from it counts as a change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 16:41:36 +01:00

60 lines
2.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { type LineMarkers, type LineSeries } from "../index.js";
export interface LineChartProps {
series: LineSeries[];
/** "GW", "weeks", "USD m": shown with every value. */
unit?: string;
caption: string;
/**
* Where the value axis starts. `zero` always, `data` at the data's rounded
* floor; left out, zero when the data sits near it and the floor otherwise.
*/
yFrom?: "zero" | "data";
/**
* A fixed value axis, e.g. `{ min: 1, max: 5, step: 1 }` for a 1–5 rating
* with integer ticks. Wins over `yFrom`. Data outside widens it.
*/
yDomain?: {
min: number;
max: number;
step?: number;
};
/** Plot height in CSS px. The width is the container's. */
height?: number;
/**
* Which values carry a dot. `all` (the default) marks every value; `none`
* draws the line alone; `ends` marks only each series' last value; `auto`
* is `all` up to 60 points on a series and `none` above — a year of daily
* closes reads as a line, not a string of beads. Whatever is drawn, every
* value can still be pointed at or tabbed to: its dot, value and period
* appear on hover and on keyboard focus, and the table holds them all.
*/
markers?: LineMarkers;
/** A light fill under each line, in the series' own token colour. */
area?: boolean;
/** Explicit BCP 47 locale; omitted preserves the existing English output. */
locale?: string;
/** Translate visible/accessibility words with the product's own dictionary. */
periodLabel?: string;
preliminaryLabel?: string;
/** App-defined reference intervals, in the same unit as the observations. */
referenceBands?: {
from: number;
to: number;
label: string;
}[];
/**
* Show the table of values to everyone behind a disclosure with this
* summary ("Show the numbers"). Each value links to the page it came from.
*/
numbers?: string;
}
/**
* One or more series on shared axes. The line is an SVG stretched to the
* plot (`preserveAspectRatio="none"`, non-scaling stroke), so it is drawn by
* the browser at any width; the axis labels and the points are HTML laid
* over it in per cent, so the text is in rem and never shrinks with the
* plot. Every point is an anchor to the page its number came from, with its
* value, period and note on hover and on keyboard focus.
*/
export declare function LineChart({ series, unit, caption, yFrom, yDomain, height, markers, area, locale, periodLabel, preliminaryLabel, referenceBands, numbers, }: LineChartProps): import("react").JSX.Element;
//# sourceMappingURL=LineChart.d.ts.map