Files
Cato 25ededa8de feat(line): yDomain fixes the value axis (a 1-5 rating with integer ticks) (#34)
vitareba's daily check-ins are 1-5 ratings; the auto scale put them on the
data's own rounded range. yDomain { min, max, step? } wins over yFrom; data
outside widens the axis by whole steps. Core: fixedScale.
2026-11-10 08:30:05 +01:00

55 lines
2.4 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;
}[];
}
/**
* 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, }: LineChartProps): import("react").JSX.Element;
//# sourceMappingURL=LineChart.d.ts.map