useChartLegend
useChartLegend: generated from the source of active-charts.
Exported by @workspace/. Generated from the package source; part of the index of every export.
Functions, hooks and constants#
- Type
() => ChartLegend
The headless legend of one chart (AF-B, ADR-105): the chart's resolved discrete legend (identity, label, key, visibility, available actions) and the chart's own legend actions, for a legend the host renders itself. Give link to exactly one chart as legend; until that chart has mounted (and on the server) entries is empty and connected false.
The chart keeps its semantics on every route: the action is announced in the chart's live region, reported once through on (source: 'api'), and guarded as the built-in legend is. The host owns the markup, roles, names and focus of its own legend.
``tsx const legend = use``
Returns
An object with these fields.
- Type
readonly ChartLegend Entry[]
The legend's entries in reading order; empty until a chart is connected.
- Type
boolean
A chart has received link and published its legend.
- Type
(entryId, action?) => boolean
The chart's own legend action on one entry (default 'toggle'). Returns whether anything changed: an unknown id, a disconnected link, legend., isolation with legend. and hiding the last visible target change nothing.
- Type
() => boolean
"Show all". Returns whether anything changed.
- Type
ChartLegend Link
Give it to exactly one chart as legend.