DumbbellChart
DumbbellChart, DumbbellChartProps, DumbbellChartSeriesConfig: generated from the source of active-charts.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Dumbbell Chart#
Generic over TDatum extends Chart; the props below name it.
Props
- Type
TDatum[]
Flat array of row objects keyed by field name.
- Type
number
Container height in pixels. Width is always responsive.
- Type
Extract<keyof TDatum, string>XKeyFor<TDatum>
- Type
boolean | LegendOptions
Enable legend. Default: false.
- Type
boolean | ZoomOptions
Enable zoom & pan. Default: false.
- Type
AccessibilityOptions
Accessibility configuration — ARIA label/description, screen-reader data table, live-region announcements. Merged with ChartDefaults.
- Type
NoUpdate Animation Option
The entrance animation. No update: the series redraws on new data without a transition (LAB-AT10).
- Type
AnnotationOptions[]
Point annotations: a label with an optional connector and marker at a data coordinate, x on the x axis and y on the value axis. The contract of <Chart>'s options. (BC1).
- Type
string
Optional className applied to the outer container.
- Type
string[]
Categorical palette for this chart only: replaces the host palette (--chart- … --chart-) in the chart's colour assignment, and nothing else. It is a data encoding, not a theme: surfaces, text, grid and semantic roles keep coming from the CSS token contract, and a series, datum or annotation that sets its own colour keeps it. Any CSS colour string (a public token reference such as var(--chart-, hex, oklch).
- Type
string
Connector stroke color. Default: the muted foreground at 0.8; a colour given here is drawn at full strength.
- Type
number
Connector stroke width in pixels. Default: 2.
- Type
boolean | CrosshairOptions
Enable crosshairs. Default: false.
- Type
CrossLine Options[]
Cross lines (reference lines/bands).
- Type
readonly ChartItem Ref[]
The initial selection of an uncontrolled chart.
- Type
"ltr""rtl"
The chart's UI direction: the reading direction of its HTML text and chrome (tooltip, legend, menus, the accessible table), and the direction the context menu carries under <body>.
Left out, the chart inherits the direction of the page around it (the nearest dir attribute, else the computed CSS direction) and follows a later change of that attribute. It is never inferred from locale, and it never reverses an axis or reorders data: reversed stays an explicit axis choice. Under rtl the chrome mirrors (legend flow, tooltip side, context menu and submenus, report text in exports), a title-like label starts at the inline start, and a label placed by geometry (an axis tick, a slice or bar label) keeps its physical side; plot arrow keys stay spatial while legend and menu arrows follow the reading direction.
- Type
string
Marker fill for the high endpoint. Default: get.
- Type
(ChartEvents & Chart Selection Even…
Every event callback in one prop, selection events included.
- Type
string
Display name for the high endpoint. Falls back to y.
- Type
boolean
Horizontal layout (categories on Y-axis). Default: false.
- Type
EndpointLabel Options
Labels at the two ends (BC-LB1, the <Chart> dumbbell series label): each value beyond its own marker, away from the other, so a reversed axis never swaps them; endpoints picks 'low', 'high' or 'both' (default). The formatter's context names the end (role). Off by default; enabled: true shows them.
- 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, labels and accessibility announcements: a locale code (notation follows the language), or a presentation-context object ({language) carrying language and notation independently. date is the normal human date shape a plain date consumer inherits; an axis that declares its own preset for readability keeps it. Forwarded untouched to the central @workspace/; the package never resolves tenant or application settings itself. When omitted, <Chart supplies it; with neither, the chart throws a configuration error (no 'en' fallback, active-format D14). Object inputs must be referentially stable across renders.
- Type
string
Display name for the low endpoint. Surfaces in the tooltip, sr-only data table header, and screen-reader announcement ({low). Falls back to y.
- Type
MarkerShape
The shape of both endpoint markers. Default: a circle; the two ends are told apart by colour and position.
- Type
number
Endpoint marker radius in pixels. Default: 6.
- Type
string
Series-level legend label. Falls back to ${low.
- Type
DatumPaint Resolver<Datum Fill>
Each end's own marker fill, by a rule over its row (BC-P1, T1): the <Chart> dumbbell series paint, called once per end with role 'low' or 'high'. Paint only; the connector and the legend keep the series colours. See Dumbbell.
- Type
Ref<ChartHandle>
Imperative handle — see Chart. Allows getting a ref to the component instance. Once the component unmounts, React will set ref. to null (or call the ref with null if you passed a callback ref).
- 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
DumbbellChart Series Config[]
Several series: side by side in their category in this order, one legend entry each; hiding one closes its gap (T4).
- Type
string
Marker fill for the low endpoint. Default: get from the active palette. Note: Dumbbell consumes two palette slots (low + high) per series, so on an 8-color palette a future multi-series dumbbell could exhaust the palette; consumers can override with explicit start / end to avoid that.
- Type
boolean | ChartSync Options
Synchronize with other charts in a SyncGroup. Default: false.
- 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
FeatureOption<Tooltip Options>
Tooltip configuration. true = defaults, false = disabled, object = explicit.
- Type
number
Optional fixed width in pixels. Default: fill container.
- Type
"category"NumericXAxis<string> TemporalXAxis<…> (Omit<AxisConfig, "formatter" | "…
- Type
AxisConfig
Y-axis configuration.
- Type
string
Key for the higher y-value (e.g. q1_).
- Type
string
Key for the lower y-value (e.g. q1_).
Events
Called by the component when something happens.
- 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
(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.
- 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
() => void
Fired exactly once per chart instance, after the first successful mount with valid dimensions and before any entrance animation starts. "Ready" means: the SVG is in the DOM, layout has run with real dimensions, and the chart can be queried by integration tests.
Distinct from on with type: 'load', which fires *after* the load animation finishes. A chart with animation={false} still fires on — animation state has no effect on readiness.
A new React key on the host produces a new component instance and on fires again. Identity changes of the callback itself after the first fire are ignored (latch is per-instance).
Consumer requirement — stable from first render. The latch closes on the first effect run regardless of whether on was defined at that moment. If on is initially undefined and later resolves to a function, the callback will never fire — the latch has already closed with a no-op. Pass a stable reference (typically via use) or pass the final function unconditionally from the first render.
Other props, such as the standard attributes of the underlying element, className and ref, are passed through.
Types#
The props of Dumbbell, each described in its prop list on this page.
type DumbbellChartProps<TDatum extends ChartDatum = ChartDatum> =
DumbbellChartBaseProps<TDatum> &
DumbbellSeriesSource &
DumbbellOrientationProps &
CartesianXKeyCategoryDefault<TDatum>;One series of a Dumbbell with several (series, T4-D12). The chart-level fields (connector, marker size and shape, labels, orientation) hold for every series.
interface DumbbellChartSeriesConfig {
id?: string;
yLowKey: string;
yHighKey: string;
lowName?: string;
highName?: string;
name?: string;
startFill?: string;
endFill?: string;
paint?: DatumPaintResolver<DatumFill>;
markerShape?: MarkerShape;
visible?: boolean;
showInLegend?: boolean;
}