Features · legend

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.

Units rose in Q2.Units rose in Q2.40455055Q1Q2
{
  "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.

LibraryStatusOptionVerificationSource
Chart.jsnativegrep: onClickdefault toggles dataset visibilitygrep · weakchart.js/dist/types/index.d.ts:1703
RechartspartialLegend.onClickhandle and hide series yourselftypes · strongrecharts/types/component/DefaultLegendContent.d.ts:97
Apache EChartsnativelegend.selectedModetypes · strongecharts/types/dist/shared.d.ts:4370
HighchartsnativeplotOptions.series.events.legendItemClicktypes · stronghighcharts/highcharts.d.ts:99848
Plotly.jsnativelayout.legend.itemclicktypes · strongplot-schema.json#layout.layoutAttributes.legend.itemclick
Nivonativegrep: toggleSerielegends[].toggleSerie (line/bar)grep · weak@nivo/bar/dist/types/hooks.d.ts:39
VictorypartialVictoryLegend.eventstypes · strongvictory-legend/lib/victory-legend.d.ts:12
visxmanualGroupmechanism · weak@visx/group/lib/Group.d.ts:15
ApexChartsnativelegend.onItemClick.toggleDataSeriestypes · strongapexcharts/types/apexcharts.d.ts:4631
Tremor (npm)unknown—unverified · unknown—
Observable Plotnone—absence · absence—
Vega-Litenativegrep: bindselection param bind: 'legend'grep · weak1165: "description"
AG Chartsnativegrep: toggleSerieslegend.item.toggleSeriesgrep · weakag-charts-enterprise/dist/types/src/series/waterfall/waterfallSeries.d.ts:185
amCharts 5nativegrep: clickTargetgrep · weak@amcharts/amcharts5/.internal/charts/flow/Flow.d.ts:79
Google Chartsunknown—conflict · unknown—
uPlotnativeOptions.legend.liveclick toggles seriestypes · stronguplot/dist/uPlot.d.ts:279
TradingView Lightweight Chartsnone—absence · absence—
MUI X Chartsnativegrep: onItemClickgrep · weak@mui/x-charts/package.json:694
Mermaid (chart-ish diagrams only)none—absence · absence—
AntV G2nativegrep: legendFilterinteraction legendFiltergrep · weak@antv/g2/lib/index.d.ts:143