Bar table reference
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
- One measure per row as a stacked bar beside number columns: one panel
- The same split in two units side by side, $bn and % of EBITDA: two panels
- Impact ranges by sector with a Total row
- Share of a total over 2 to 4 periods, such as category revenue share by year: cascade
Chart IDs
bartable.panels: fixtureimpact-two-panels-named-sharebartable.cascade: fixturecascade-two-periods
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
| Path | Type | Required | Meaning |
|---|---|---|---|
| categories | array | yes | The rows, top to bottom. |
| categories[].id | string | yes | Row identity; not __total, which names the Total row. |
| categories[].label | string | Row name in the label column; defaults to the id. Long names wrap to two lines. | |
| categories[].group | string | Row group id from data.rowGroups: the bar takes its color. Required under rowGroups, except on a residual row. | |
| categories[].residual | boolean | A rest row ("Rest of world"): neutral gray, pinned below the other rows. | |
| series | array | yes | The segments of every bar, left to right. Two or more draw a key; one draws none and the panel head names the measure. |
| series[].id | string | yes | Segment identity; every panel keys its values by it. |
| series[].label | string | Segment name in the key; defaults to the id. | |
| series[].colorRole | string | Theme 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[].fill | string | Explicit CSS fill for this segment. | |
| columns | array | Number columns between the row labels and the panels, such as a count per row. Zero or more. | |
| columns[].id | string | yes | Column identity; distinct from every panel id. |
| columns[].label | string | Column head, right-aligned over the numbers; wraps to two lines. | |
| columns[].values | array | yes | One number per row, in row order; null prints the missing glyph, { state } n/a or n.m. |
| columns[].values[].state | string | yes | 'na' prints n/a, 'nm' prints n.m. One of 'na', 'nm'. |
| columns[].format | string | Format by example, such as 1,234 or 12.5%. | |
| columns[].aggregate | string | What 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'. | |
| panels | array | yes | One 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[].id | string | yes | Panel identity; distinct from every column id. |
| panels[].label | string | The measure, printed in the head as "label, unit". | |
| panels[].unit | string | Unit of this panel, such as $bn or %; printed in the head, never in the end labels. | |
| panels[].weight | number | Share of the width left for the panels; default 1. A weight of 2 beside 1 gives the first panel two thirds. | |
| panels[].values | object | yes | Segment id -> one value per row, in row order. Every segment in data.series appears, and every key is a segment id. |
| panels[].values.*[].state | string | yes | 'na' prints n/a, 'nm' prints n.m. One of 'na', 'nm'. |
| panels[].ends | array | Per 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[].low | number | yes | Lower end of the row total, where the segments end; zero or more. |
| panels[].ends[].high | number | yes | Upper end of the row total, where the light extension ends; at least low. |
| panels[].format | string | Format by example for the end labels and the total; falls back to options.format. | |
| panels[].aggregate | string | What 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'. | |
| rowGroups | object | Color bars by a row attribute, keyed under a title. Needs one segment. | |
| rowGroups.title | string | Key title with the unit ("Margin of market, %"). | |
| rowGroups.groups | array | yes | In key order. |
| rowGroups.groups[].id | string | yes | Group identity; rows name it in group. |
| rowGroups.groups[].label | string | Name in the key; defaults to the id. | |
| rowGroups.groups[].colorRole | string | Theme 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[].fill | string | Explicit CSS fill. |
Options
| Path | Type | Values | Default | Meaning |
|---|---|---|---|---|
| labels | object | Which printed values stay. | ||
| labels.point | false | false | false 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. | |
| total | boolean | true | Closing 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. | |
| totalPosition | string | 'top', 'bottom' | Where the Total row stands, with its rule and ground; default 'bottom'. Works under cascade. With total false it warns option-ignored. | |
| columnOverrides | object | Settings per generated column. Ids: label, each data.columns id and each data.panels id. | ||
| columnOverrides.*.width | number | Track width in px. It beats the width the type would pick. | ||
| columnOverrides.*.align | string | '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.*.headAlign | string | 'left', 'right', 'center' | Head alignment; defaults to align. | |
| columnOverrides.*.label | string | Head text. | ||
| columnOrder | array | Order of whole blocks; blocks left out follow in default order. Ids: numbers, panels. | ||
| columnHeads | false | false | false: 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. | |
| combinedShare | object | A 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.rows | array | Row ids whose combined share prints; at least two, each once. | ||
| combinedShare.label | string | What the rows are called together in the note; default their labels joined with 'and'. | ||
| segmentValues | boolean | Default 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'. | ||
| variant | string | '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. | |
| cascade | object | Settings of variant 'cascade'; refused with variant 'panels'. | ||
| cascade.totalApart | boolean | Row 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.share | boolean | Computed share column beside each panel; default true. Each share rounds on its own; rounding 'sum-consistent' makes each column add up to 100%. | ||
| cascade.growth | object | Growth column after the last panel. | ||
| cascade.growth.measure | string | '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.years | number | Years 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.label | string | Column head; default from the panel labels. | ||
| sharedScale | boolean | false: each panel its own scale. true: one scale, panel width follows its longest bar; weights refused. Default false, true under cascade. | ||
| heightFill | string | '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
| ID | Kind | Use case |
|---|---|---|
| impact-two-panels | torture | Two panels, one split: the impact in $bn and as a share of EBITDA, with a count column and a Total row |
| single-panel | example | One measure: one panel, no number columns, the stack sum at the end of each bar |
| null-and-long-labels | torture | A missing segment, a row name cut after two lines, a wide range label and a column that does not sum |
| one-series-missing-and-states | torture | One 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-share | example | Two 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-periods | example | Share 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-total | example | Share cascade over two periods with the Total bar in the theme total color, even where it equals a group color |
| cascade-four-years | example | Share cascade over four years: product-category revenue share with the share change in pp |
| columns-reordered | example | Panels before the number columns |
| total-top | example | The Total row above the rows, with its rule and ground |
| no-values | example | No values at the bars: number columns and the Total keep theirs |
| column-widths | example | Authored widths, alignment and heads per column |
| no-column-heads | example | No 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.