Draw order / z-index
native
Control series stacking order
Matrix status native. Verification render · strong. ChartKit option: ChartKitChartSpecV1.encoding.y.z, ChartKitChartSpecV1.annotations.z.
encoding.y[].z and annotations[].z. Higher paints later. Stacked series keep data order. z below 0 paints an annotation under the marks. zIndex repairs to z (CK3064).
Source: chartkit:packages/core/src/renderers/cartesian.ts
ChartKit spec
Passed validate() during npm run matrix:refresh. The SVG is the server render.
{
"version": "1",
"type": "line",
"data": [
{
"quarter": "Q1",
"units": 40,
"other": 22
},
{
"quarter": "Q2",
"units": 55,
"other": 18
}
],
"encoding": {
"x": "quarter",
"y": [
{
"field": "units",
"z": 2
},
{
"field": "other",
"z": 0
}
]
},
"a11y": {
"alt": "Units stay above the other series."
},
"size": {
"width": 640,
"height": 260
},
"annotations": [
{
"type": "rule",
"axis": "y",
"value": 30,
"z": -1,
"label": "Floor"
}
]
}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: mark.zindex.md.
| Library | Status | Option | Verification | Source |
|---|---|---|---|---|
| Chart.js | native | ChartConfiguration.data.datasets.order | types · strong | chart.js/dist/types/index.d.ts:83 |
| Recharts | native | grep: zIndexZIndexLayer (v3) | grep · weak | recharts/types/index.d.ts:130 |
| Apache ECharts | native | series.z, series.zlevel | types · strong | echarts/types/dist/shared.d.ts:8228 |
| Highcharts | native | plotOptions.series.zIndex | types · strong | highcharts/options/series.d.ts:1377 |
| Plotly.js | partial | grep: ordertrace order | grep · weak | @types/plotly.js/index.d.ts:239 |
| Nivo | native | Line.layers | types · strong | @nivo/line/dist/types/types.d.ts:171 |
| Victory | partial | VictoryChartchild order | types · strong | victory-chart/lib/victory-chart.d.ts:3 |
| visx | partial | Group | types · strong | @visx/group/lib/Group.d.ts:15 |
| ApexCharts | unknown | — | conflict · unknown | — |
| Tremor (npm) | none | — | absence · absence | — |
| Observable Plot | partial | marksmark order | types · strong | @observablehq/plot/src/mark.d.ts:496 |
| Vega-Lite | partial | grep: layer | grep · weak | 579: "description" |
| AG Charts | partial | grep: zIndex | grep · weak | ag-charts-community/dist/types/src/module-support.d.ts:98 |
| amCharts 5 | native | grep: zIndex | grep · weak | @amcharts/amcharts5/.internal/charts/xy/axes/Axis.d.ts:218 |
| Google Charts | none | — | absence · absence | — |
| uPlot | partial | Options.seriesseries order | types · strong | uplot/dist/uPlot.d.ts:375 |
| TradingView Lightweight Charts | native | grep: zOrder | grep · weak | 2182: * @returns the desired position in the visual layer stack. @see {@link PrimitivePaneViewZOrder} |
| MUI X Charts | partial | grep: zIndex | grep · weak | @mui/x-charts/index.d.ts:29 |
| Mermaid (chart-ish diagrams only) | none | — | absence · absence | — |
| AntV G2 | native | grep: zIndex | grep · weak | @antv/g2/lib/component/axis.d.ts:6 |