Features · axis

Axis offset / origin crossing

native

Move axis to cross at zero or offset it from the plot

Matrix status native. Verification render · strong. ChartKit option: ChartKitChartSpecV1.axes.x.crosses, ChartKitChartSpecV1.axes.y.offset.

axes.x.crosses is the y value the x axis passes through, so 0 draws it through zero. axes.y.crosses needs a quantitative x (CK3060). axes.y.offset shifts the axis in px, from -80 to 80. position zero, and the keys zero, origin, and axisAtZero, repair to crosses (CK3068). axisOffset repairs to offset (CK3071).

Source: chartkit:packages/core/src/renderers/cartesian.ts

ChartKit spec

Passed validate() during npm run matrix:refresh. The SVG is the server render.

Units rose in Q2.Units rose in Q2.0204060Q1Q2
{
  "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
  },
  "axes": {
    "x": {
      "crosses": 0,
      "line": true
    },
    "y": {
      "offset": 12
    }
  }
}

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: axis.offset.md.

LibraryStatusOptionVerificationSource
Chart.jsnativegrep: offsetposition: {y: 0}grep · weakchart.js/dist/types/layout.d.ts:3
RechartsnativeYAxis.mirror, XAxis.ytypes · strongrecharts/types/cartesian/YAxis.d.ts:112
Apache EChartsnativexAxis.axisLine.onZero, xAxis.offsettypes · strongecharts/types/dist/shared.d.ts:2753
HighchartsnativexAxis.offsettypes · stronghighcharts/highcharts.d.ts:108503
Plotly.jsnativelayout.xaxis.anchor, layout.xaxis.positiontypes · strongplot-schema.json#layout.layoutAttributes.xaxis.anchor
Nivonativegrep: tickPaddinggrep · weak@nivo/tree/dist/types/types.d.ts:194
VictorynativeVictoryAxis.offsetX, VictoryAxis.crossAxistypes · strongvictory-axis/lib/victory-axis.d.ts:8
visxnativeAxisBottom.toptypes · strong@visx/axis/lib/types.d.ts:116
ApexChartsnativexaxis.offsetYtypes · strongapexcharts/types/apexcharts.d.ts:4905
Tremor (npm)none—absence · absence—
Observable Plotnativegrep: insetTopgrep · weak@observablehq/plot/src/scales.d.ts:314
Vega-Litenativegrep: offsetgrep · weak350: "description"
AG Chartsnativegrep: crossAtgrep · weakag-charts-types/dist/types/src/presets/quadrant/quadrantOptions.d.ts:2
amCharts 5partialgrep: xgrep · weak@amcharts/amcharts5/.internal/plugins/exporting/ExportingCSS.d.ts:6
Google Chartsunknown—conflict · unknown—
uPlotunknown—conflict · unknown—
TradingView Lightweight Chartsunknown—conflict · unknown—
MUI X Chartsnativegrep: offsetgrep · weak@mui/x-charts/SparkLineChart/SparkLineChart.d.ts:106
Mermaid (chart-ish diagrams only)unknown—conflict · unknown—
AntV G2nativegrep: positiongrep · weak@antv/g2/lib/index.d.ts:2