Chart
Chart, ChartProps: generated from the source of active-charts.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Chart#
Generic over TDatum extends Chart; the props below name it.
Props
- Type
TDatum[]
Chart data — array of objects.
- Type
number
Container height in pixels.
- Type
ChartOptions<TDatum>
Full configuration object. Its context menu hands the host the Cartesian of a row.
- Type
string
Optional className for the outer container.
- Type
readonly ChartItem Ref[]
The initial selection of an uncontrolled chart.
- Type
"ltr""rtl"
The chart's UI direction: explicit here, else inherited from the page, else ltr; never inferred from locale. It governs the chart's HTML text and chrome, never the axes or the data order.
- Type
(ChartEvents & Chart Selection Even…
The events as one bundle, as on every family: an event given here counts like its individual prop, and the individual prop wins.
- Type
ChartLegend Link
Connects the chart's legend to use, for a legend the host renders itself. Give one link to one chart.
- Type
ValuePresentation
Presentation input for axis labels, tooltips, and crosshairs: a locale code, or a presentation-context object accepted by the central active-format formatters. When omitted, <Chart supplies it; with neither, the chart throws a configuration error (no 'en' fallback).
- Type
readonly ChartItem Ref[]
The selection, controlled by the host. The chart draws, announces and lists the items it resolves to and never changes it; the host updates it from on. A request the host applies is announced when the host passes it back; one it ignores is never announced. A reference to an item that is hidden, zoomed or drilled out of view, or not in the data stays in the host's selection and is not shown as selected.
- Type
ChartTranslate Fn
The host translator for every text the chart shows or announces. When omitted, <Chart supplies it; with neither, the chart throws a configuration error (no English fallback, ADR-028).
- Type
number
Optional fixed width in pixels. When omitted (default), width is measured responsively from the container. When provided, responsive measurement is skipped and this value is used directly.
Events
Called by the component when something happens.
- Type
(event) => void
Fired when a chart animation completes.
'load': initial mount animation finished (or immediately if animation disabled / prefers-reduced-motion is active).'update': data-update transition finished.
Not triggered by zoom animations (use on) or tooltip fades.
- Type
(result) => void
Fired after a successful export action (PNG/SVG/CSV/PDF), including from the context menu and from imperative Chart calls.
- Type
(format, error) => void
Fired when an export could not produce its file (W11), from the handle as well as from the context menu. Without it a failed context-menu export is reported as an error diagnostic (<Chart).
- Type
(item, source) => void
Fired when the reader activates an item: a click or tap on it, or Enter on the focused item (Shift+Enter on a sankey, whose Enter moves between nodes and links). With a handler, Enter activates instead of opening the context menu (Shift+F10 and the context-menu key still open it).
- Type
(change) => void
Fired once for every legend change the chart applies: a hide, a show, an isolation or a show-all, from the built-in legend (click, key, double click, double tap), its menu, or use. The change names the entry and its target by identity and lists every hidden target after it. A refused action (the last visible target, legend.) changes nothing and reports nothing.
- Type
() => void
Fired exactly once per chart instance, after the first successful mount with valid dimensions and before any entrance animation starts. See Chart for the full semantics.
- Type
(selection, change) => void
Fired when the reader changes the selection (pointer, touch or keyboard), and when an uncontrolled selection drops items the data no longer contains. selection is the complete selection the change makes; it keeps every reference the selection held, of whatever form. On a controlled chart it is a proposal (change.), computed from the current selected and never from an earlier proposal; the host applies it, changes it or ignores it.
- Type
function
Fired when the zoom range changes (after animation completes). Fractions [0..1]. Y params are only provided when Y-zoom is active. Cartesian charts only.
Other props, such as the standard attributes of the underlying element, className and ref, are passed through.
Types#
The props of Chart, each described in its prop list on this page.
interface ChartProps<TDatum extends ChartDatum = ChartDatum>
extends ChartEvents, ChartSelectionState, ChartSelectionEvents<TDatum> {
data: TDatum[];
options: ChartOptions<TDatum>;
events?: ChartEvents & ChartSelectionEvents<TDatum>;
height: number;
width?: number;
className?: string;
dir?: 'ltr' | 'rtl';
locale?: ChartPresentation;
t?: ChartTranslateFn;
onReady?: () => void;
legendLink?: ChartLegendLink;
}