Features · label

Stack totals

native

Label the total on stacked bars

Matrix status native. Verification runtime · strong. ChartKit option: ChartKitChartSpecV1.mark.stackTotal.

Labels the total on a stacked bar or stacked area. On a bar this also stacks the series.

Source: packages/core/src/totals.ts:6

ChartKit spec

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

B is higher.B is higher.ab560246AB
{
  "version": "1",
  "type": "stacked-area",
  "data": [
    {
      "x": "A",
      "a": 2,
      "b": 3
    },
    {
      "x": "B",
      "a": 4,
      "b": 2
    }
  ],
  "encoding": {
    "x": "x",
    "y": [
      "a",
      "b"
    ]
  },
  "a11y": {
    "alt": "B is higher."
  },
  "size": {
    "width": 640,
    "height": 260
  },
  "mark": {
    "stackTotal": 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: label.total.md.

LibraryStatusOptionVerificationSource
Chart.jsplugin—npm · weak—
RechartsmanualCustomizedmechanism · weakrecharts/types/component/Customized.d.ts:26
Apache EChartsmanualseries.type=custommechanism · weakecharts/types/dist/shared.d.ts:11176
HighchartsnativeyAxis.stackLabelstypes · stronghighcharts/highcharts.d.ts:110590
Plotly.jsmanuallayout.shapesmechanism · weakplot-schema.json#layout.layoutAttributes.shapes
NivonativeBar.enableTotalstypes · strong@nivo/bar/dist/types/types.d.ts:176
VictorymanualVictoryBarProps.dataComponentmechanism · weakvictory-core/lib/victory-util/common-props.d.ts:9
visxmanualGroupmechanism · weak@visx/group/lib/Group.d.ts:15
ApexChartsnativeplotOptions.bar.dataLabels.totaltypes · strongapexcharts/types/apexcharts.d.ts:3140
Tremor (npm)none—absence · absence—
Observable Plotmanualgrep: rendertext on groupX summechanism · weak@observablehq/plot/src/scales.d.ts:166
Vega-LitemanualTopLevelSpec.layermechanism · weakvega-lite/build/spec/layer.d.ts:27
AG Chartsunknown—unverified · unknown—
amCharts 5manualGraphicsmechanism · weak@amcharts/amcharts5/.internal/core/render/Graphics.d.ts:162
Google Chartsnone—absence · absence—
uPlotnone—absence · absence—
TradingView Lightweight Chartsnone—absence · absence—
MUI X ChartsmanualChartsContainermechanism · weak@mui/x-charts/ChartsContainer/ChartsContainer.d.mts:34
Mermaid (chart-ish diagrams only)none—absence · absence—
AntV G2manualgrep: registermechanism · weak@antv/g2/lib/exports.d.ts:2