Bar table reference

Bar table examples

Contents: Use cases, Chart IDs, Minimal spec, Data, Options, Annotations, Sizing, Fixtures, Not for.

Table rows with number columns and stacked bars. One panel when the rows compare one measure (impact in $bn, split into Run and Grow); several panels when the same split reads in different units side by side ($bn and % of EBITDA). Each panel has its own scale; the end label is the row total or an authored range, whose bar fills the segments to low and extends lightly to high. variant 'cascade': panels as periods of one total (category share by year). Type bartable. Aliases: bar-table, table-bars.

Use cases

Chart IDs

Minimal spec

{
  "type": "bartable",
  "data": {
    "categories": [{ "id": "sw", "label": "Software" }, { "id": "ut", "label": "Utilities" }],
    "series": [{ "id": "run", "label": "Run" }, { "id": "grow", "label": "Grow" }],
    "columns": [{ "id": "n", "label": "# of companies", "values": [30, 45], "format": "1,234" }],
    "panels": [
      {
        "id": "abs",
        "label": "EBITDA impact",
        "unit": "$bn",
        "weight": 2,
        "values": { "run": [40, 30], "grow": [100, 75] },
        "ends": [{ "low": 110, "high": 160 }, { "low": 80, "high": 160 }]
      },
      {
        "id": "pct",
        "label": "Share of 2030 EBITDA",
        "unit": "%",
        "weight": 1,
        "aggregate": "none",
        "values": { "run": [8, 9], "grow": [26, 30] },
        "ends": [{ "low": 28, "high": 40 }, { "low": 29, "high": 60 }]
      }
    ]
  },
  "options": {
    "total": true,
    "title": "Software and utilities carry half of the upside",
    "subtitle": { "measure": "Estimated 2030 EBITDA run-rate impact" },
    "source": "Illustrative model"
  }
}

Data

PathTypeRequiredMeaning
categoriesarrayyesThe rows, top to bottom.
categories[].idstringyesRow identity; not __total, which names the Total row.
categories[].labelstringRow name in the label column; defaults to the id. Long names wrap to two lines.
categories[].groupstringRow group id from data.rowGroups: the bar takes its color. Required under rowGroups, except on a residual row.
categories[].residualbooleanA rest row ("Rest of world"): neutral gray, pinned below the other rows.
seriesarrayyesThe segments of every bar, left to right. Two or more draw a key; one draws none and the panel head names the measure.
series[].idstringyesSegment identity; every panel keys its values by it.
series[].labelstringSegment name in the key; defaults to the id.
series[].colorRolestringTheme color role for this segment when no fill is set. One of good, bad, warn, neutral, neutralLight, highlight, total, others; series-N for step N of the theme ramp, 1-based (series-2 is color.series[1]); or status-<key> for a theme status color. A hex color goes in fill.
series[].fillstringExplicit CSS fill for this segment.
columnsarrayNumber columns between the row labels and the panels, such as a count per row. Zero or more.
columns[].idstringyesColumn identity; distinct from every panel id.
columns[].labelstringColumn head, right-aligned over the numbers; wraps to two lines.
columns[].valuesarrayyesOne number per row, in row order; null prints the missing glyph, { state } n/a or n.m.
columns[].values[].statestringyes'na' prints n/a, 'nm' prints n.m. One of 'na', 'nm'.
columns[].formatstringFormat by example, such as 1,234 or 12.5%.
columns[].aggregatestringWhat the Total row prints: 'sum' (default) adds the column, 'none' leaves the cell empty for numbers that do not add up, such as averages or rates. The default is 'none' where the column format is a percentage, percentage points or a multiple; an explicit 'sum' there warns aggregate-non-additive. One of 'sum', 'none'.
panelsarrayyesOne stacked-bar panel per measure, each with its own unit and scale. Use one panel when the rows compare one measure: EBITDA impact in $bn, split into Run and Grow. Use several when the same split reads in different units side by side: the impact in $bn and the same impact as % of EBITDA. Bars in different panels compare by length only under sharedScale true. Under variant 'cascade' the panels are periods of one total.
panels[].idstringyesPanel identity; distinct from every column id.
panels[].labelstringThe measure, printed in the head as "label, unit".
panels[].unitstringUnit of this panel, such as $bn or %; printed in the head, never in the end labels.
panels[].weightnumberShare of the width left for the panels; default 1. A weight of 2 beside 1 gives the first panel two thirds.
panels[].valuesobjectyesSegment id -> one value per row, in row order. Every segment in data.series appears, and every key is a segment id.
panels[].values.*[].statestringyes'na' prints n/a, 'nm' prints n.m. One of 'na', 'nm'.
panels[].endsarrayPer row, in row order: a range for the row total, or null for none. A row with a range draws its segments to low, each keeping its share of the segments' sum, then a light outlined extension from low to high, and prints "low–high" after it. So the segment values set the split only: Run 40 and Grow 100 with a range of 110–160 draw, hover and list in the data table as about 31 and 79, their parts of 110. A row without a range draws and prints its sum. The Total row adds the ranges, counting a row without one at its sum at both ends.
panels[].ends[].lownumberyesLower end of the row total, where the segments end; zero or more.
panels[].ends[].highnumberyesUpper end of the row total, where the light extension ends; at least low.
panels[].formatstringFormat by example for the end labels and the total; falls back to options.format.
panels[].aggregatestringWhat the Total row prints for this panel: 'sum' (default) adds the rows, or their ranges when a row has one; 'none' leaves it empty. The default is 'none' where the panel format (or options.format) is a percentage, percentage points or a multiple, or the unit is '%', except under variant 'cascade'; an explicit 'sum' there warns aggregate-non-additive. Use 'none' for shares, rates or averages, such as a % of each row's own base, whose sum means nothing. One of 'sum', 'none'.
rowGroupsobjectColor bars by a row attribute, keyed under a title. Needs one segment.
rowGroups.titlestringKey title with the unit ("Margin of market, %").
rowGroups.groupsarrayyesIn key order.
rowGroups.groups[].idstringyesGroup identity; rows name it in group.
rowGroups.groups[].labelstringName in the key; defaults to the id.
rowGroups.groups[].colorRolestringTheme color role when no fill is set. One of good, bad, warn, neutral, neutralLight, highlight, total, others; series-N for step N of the theme ramp, 1-based (series-2 is color.series[1]); or status-<key> for a theme status color. A hex color goes in fill.
rowGroups.groups[].fillstringExplicit CSS fill.

Options

PathTypeValuesDefaultMeaning
labelsobjectWhich printed values stay.
labels.pointfalsefalsefalse stops the values in the segments and at the bar ends, in panels and in a cascade. Number columns, shares, growth and the Total row keep their numbers; hover and records keep the values. A missing row keeps its mark.
totalbooleantrueClosing Total row, labeled with strings.total; default true. Summed number columns print their sum; a panel prints the summed ranges when a row has one (a row without counts its sum at both ends), else the sum of the bars, as text without a bar.
totalPositionstring'top', 'bottom'Where the Total row stands, with its rule and ground; default 'bottom'. Works under cascade. With total false it warns option-ignored.
columnOverridesobjectSettings per generated column. Ids: label, each data.columns id and each data.panels id.
columnOverrides.*.widthnumberTrack width in px. It beats the width the type would pick.
columnOverrides.*.alignstring'left', 'right', 'center'Alignment of the column: its cell text and, unless headAlign is set, its head. Bars keep starting at the panel origin.
columnOverrides.*.headAlignstring'left', 'right', 'center'Head alignment; defaults to align.
columnOverrides.*.labelstringHead text.
columnOrderarrayOrder of whole blocks; blocks left out follow in default order. Ids: numbers, panels.
columnHeadsfalsefalsefalse: no visible head row and no group heads, with their height and rule. Assistive technology still reads the head in React, and sortable warns there.
combinedShareobjectA note with the combined share of these rows in each summed panel: their sum over the panel's, at the low and the high end where rows carry ranges ('Core segments: 120 of 300 $bn at the low end, 40%; 210 of 500 at the high end, 42%'). A row id that names no row is refused.
combinedShare.rowsarrayRow ids whose combined share prints; at least two, each once.
combinedShare.labelstringWhat the rows are called together in the note; default their labels joined with 'and'.
segmentValuesbooleanDefault true: variant 'panels' prints each part's value inside its segment, in the ink that reads on the fill, where the text and 3 px of padding on each side fit. A panel whose format has more than one decimal prints end labels only, and so does a row with a range. false prints end labels only everywhere. Rounded parts can miss the printed row sum by one step; the notes list says so. Refused with variant 'cascade'.
variantstring'panels', 'cascade''panels' (default): one stacked-bar panel per measure. 'cascade': share cascade, each panel splits its total; a row starts where the row above ended, on a light track over the total. The Total row is a dark bar. combinedShare draws a bracket over its rows, which must follow one another. Needs one segment, no ends, no nulls.
cascadeobjectSettings of variant 'cascade'; refused with variant 'panels'.
cascade.totalApartbooleanRow groups only. true (default): the Total bar deepens away from the group colors and the rest gray where the theme total color reads as one of them. false: the Total bar keeps the theme total color (color.total) as it is.
cascade.sharebooleanComputed share column beside each panel; default true. Each share rounds on its own; rounding 'sum-consistent' makes each column add up to 100%.
cascade.growthobjectGrowth column after the last panel.
cascade.growth.measurestring'cagr', 'share-change''cagr': each row's CAGR, first panel to last, in %. 'share-change': last share minus first, in pp, from the received shares; the column prints two digits in every group of its changes (−7.8 · −0.43).
cascade.growth.yearsnumberYears from first to last panel for 'cagr'; default read from the panel labels (2019, FY24). 'share-change' reads no years and warns option-ignored.
cascade.growth.labelstringColumn head; default from the panel labels.
sharedScalebooleanfalse: each panel its own scale. true: one scale, panel width follows its longest bar; weights refused. Default false, true under cascade.
heightFillstring'rows', 'none''rows'Spare canvas height. 'rows' (default): a pinned canvas stretches the rows up to 1.25 times their pitch and thickens the bars. 'none': natural pitch.

Plus the shared options. This type does not accept detailFields, labelPosition, valueAxis, hatchStrength, annotations. This type ignores animate, debug, rowLabels, categoryAxis, categoryLabels, secondaryAxis, sort, topN, bandFraction, valueAxis.show, valueAxis.gridlines, highlight with an option-ignored warning.

Annotations

This type takes no annotations.

Sizing

Floor 280 × 28 px; fit content.

Below the floor a render is refused with size-below-floor and the pixels it needs. measure returns the natural and comfortable size for a given spec; see Sizing in the manual.

Fixtures

IDKindUse case
impact-two-panelstortureTwo panels, one split: the impact in $bn and as a share of EBITDA, with a count column and a Total row
single-panelexampleOne measure: one panel, no number columns, the stack sum at the end of each bar
null-and-long-labelstortureA missing segment, a row name cut after two lines, a wide range label and a column that does not sum
one-series-missing-and-statestortureOne segment with a missing value, a not-applicable cell and a not-meaningful cell, in a bar panel and a number column: each prints its own glyph
impact-two-panels-named-shareexampleTwo panels, one split: the impact in $bn and as a share of EBITDA, with the combined-share note naming the two rows the two largest sectors
cascade-two-periodsexampleShare cascade over two periods: rows colored by a row group, two residual rows pinned last, share columns, a bracket and a CAGR column
cascade-two-periods-theme-totalexampleShare cascade over two periods with the Total bar in the theme total color, even where it equals a group color
cascade-four-yearsexampleShare cascade over four years: product-category revenue share with the share change in pp
columns-reorderedexamplePanels before the number columns
total-topexampleThe Total row above the rows, with its rule and ground
no-valuesexampleNo values at the bars: number columns and the Total keep theirs
column-widthsexampleAuthored widths, alignment and heads per column
no-column-headsexampleNo head row: the first row starts at the top of the table

Not for

Values of different sign: bars grow from zero. Comparing bars of different units by length: each panel has its own scale.