Click to toggle series
native
Legend items hide/show series
Matrix status native. Verification types · strong. ChartKit option: ChartKitChartSpecV1.legend.interactive.
client interact module; off unless set (schema default false)
Source: chartkit:packages/core/src/generated/schema.ts:177
ChartKit spec
Passed validate() during npm run matrix:refresh. The SVG is the server render.
{
"version": "1",
"type": "line",
"data": [
{
"quarter": "Q1",
"units": 40
},
{
"quarter": "Q2",
"units": 55
}
],
"encoding": {
"x": "quarter",
"y": "units"
},
"a11y": {
"alt": "Units rose in Q2."
},
"size": {
"width": 640,
"height": 260
},
"legend": {
"interactive": true
}
}Other libraries
Option names are the paths recorded in the matrix. A grep-only cell names the identifier that matched, not a render test. Markdown copy: legend.interactive.md.
| Library | Status | Option | Verification | Source |
|---|---|---|---|---|
| Chart.js | native | grep: onClickdefault toggles dataset visibility | grep · weak | chart.js/dist/types/index.d.ts:1703 |
| Recharts | partial | Legend.onClickhandle and hide series yourself | types · strong | recharts/types/component/DefaultLegendContent.d.ts:97 |
| Apache ECharts | native | legend.selectedMode | types · strong | echarts/types/dist/shared.d.ts:4370 |
| Highcharts | native | plotOptions.series.events.legendItemClick | types · strong | highcharts/highcharts.d.ts:99848 |
| Plotly.js | native | layout.legend.itemclick | types · strong | plot-schema.json#layout.layoutAttributes.legend.itemclick |
| Nivo | native | grep: toggleSerielegends[].toggleSerie (line/bar) | grep · weak | @nivo/bar/dist/types/hooks.d.ts:39 |
| Victory | partial | VictoryLegend.events | types · strong | victory-legend/lib/victory-legend.d.ts:12 |
| visx | manual | Group | mechanism · weak | @visx/group/lib/Group.d.ts:15 |
| ApexCharts | native | legend.onItemClick.toggleDataSeries | types · strong | apexcharts/types/apexcharts.d.ts:4631 |
| Tremor (npm) | unknown | — | unverified · unknown | — |
| Observable Plot | none | — | absence · absence | — |
| Vega-Lite | native | grep: bindselection param bind: 'legend' | grep · weak | 1165: "description" |
| AG Charts | native | grep: toggleSerieslegend.item.toggleSeries | grep · weak | ag-charts-enterprise/dist/types/src/series/waterfall/waterfallSeries.d.ts:185 |
| amCharts 5 | native | grep: clickTarget | grep · weak | @amcharts/amcharts5/.internal/charts/flow/Flow.d.ts:79 |
| Google Charts | unknown | — | conflict · unknown | — |
| uPlot | native | Options.legend.liveclick toggles series | types · strong | uplot/dist/uPlot.d.ts:279 |
| TradingView Lightweight Charts | none | — | absence · absence | — |
| MUI X Charts | native | grep: onItemClick | grep · weak | @mui/x-charts/package.json:694 |
| Mermaid (chart-ish diagrams only) | none | — | absence · absence | — |
| AntV G2 | native | grep: legendFilterinteraction legendFilter | grep · weak | @antv/g2/lib/index.d.ts:143 |