Bar charts

Compare categories horizontally when labels are long or rank matters.

bar is the horizontal categorical family. It uses the same category and value roles as column, but gives labels more horizontal room and makes top-to-bottom ranking natural.

Ranked comparison

Edit to update the chart

For ranking, sort by value and place the largest category first. An explicit category list is better when the order has domain meaning, such as funnel stages or survey responses.

Grouped and stacked bars

Use a series role or wide values for multiple series. arrangement: { type: "grouped" } compares series directly; { type: "stacked" } emphasizes totals and composition.

Ranged bars

Use values.type: "range" for durations and intervals that have a start and end but no central estimate. A ranged bar is horizontal; use column for the vertical orientation. The category scale is band, while the value scale may be linear, log, or UTC.

{
  "type": "bar",
  "category": { "field": "phase" },
  "values": {
    "type": "range",
    "start": { "field": "startsAt" },
    "end": { "field": "endsAt" },
    "scale": { "type": "utc" }
  }
}

Every end must be after its start. Ranged bars have no series, stacking, grouping, normalization, aggregation, labels, references, or annotations, and sort only by category or an explicit list. Spacing, color, corners, strokes, and axes work as on ordinary bars.

Labels and corners

Category names sit to the left of the bars. When the longest name would take more than 30% of the chart’s width, they move above their bars instead, starting where each bar starts, so the bars keep the full width. Names longer than the chart wrap onto a second line; the category axis line then only appears if you set categoryAxis: { line: true }.

Native labels account for bar length, stacking, series, and contrast. Simple and grouped labels can use auto, inside, or outside. An inside label sits at the end of its bar, where the eye finishes reading the length; an outside label is not dropped just because it is taller than its bar, and a zero value stays visible to the right of its zero-length bar.

Stacked segment labels stay centered inside and disappear when they do not fit. A stack with only one segment per bar, such as a single series, labels its bars at the end like a simple bar chart; totals: true adds an outside total, and omitting it or setting false hides totals. cornerRadius rounds only the exposed ends, so stacked segments still meet cleanly.

Use labels selectively on dense grouped charts. A shared value axis may communicate comparison more clearly than printing every number.

Draw one series as a line

line.series draws the named series as a line on the same value scale instead of as bars, for a benchmark, a total, or a co-measure:

{ "line": { "series": ["Active paying"], "curve": "monotone" } }

It needs a series, cannot name every series, and is unavailable on ranged bars and percent-normalized stacks. See promoted lines for the full rules.

References and annotations

Fixed reference lines work well for targets or service-level thresholds; calculated references can follow the average, median, minimum, or maximum of visible or all data. Category references identify a particular band. Attach an annotation to a category and series when it should follow that datum through updates and filtering; use { type: "coordinate", category, value } for an exact position.

Properties

FieldTypeDefaultDescription
version"2026-09-26"–Required. The chart config version.
typeChartType–Required. The chart family.
titlestring– Chart title.
subtitlestring– Supporting text beneath the title.
captionstring– Caption below the chart for a source, methodology note, or date.
accessibilityDescriptionstring– Accessible description of the chart's meaning.
headerAlign"start" | "center" | "end"theme default Horizontal alignment for the title and subtitle. Omit it to use the selected theme's alignment.
localestring"en-US" Locale identifier accepted by JavaScript Intl and associated with the chart content, such as en, pl, or zh-Hant.
themeThemeName"editorial" One of 6 built-in themes.
themeOverridesThemeOverrides– Override individual theme properties.
categoryBarCategoryRole | RangeCategoryRole–Required. Category field; band or UTC scales for scalar bars, and band scales for ranges.
valuesValuesRole | RangeValuesRole–Required. Long, wide, count, or start/end range values.
arrangementBarArrangementPreferencestacked for series values Stacked or grouped placement for series values; percent normalization belongs to the stacked branch. Omit for simple and ranged bars.
orderCategoryOrder | RangeCategoryOrder– Category/value sorting or explicit order for scalar bars; ranges support category sorting or explicit order.
spacingBarSpacingPreference– Category spacing; series spacing is available only for grouped bars.
colorCategoricalColor– Categorical color preferences.
categoryAxisboolean | AxisOptions– True shows the category axis, false hides it, and an options object shows it with those settings. Omit for defaults.
plotBorderbooleantheme default Full plot border, independent of axis visibility.
valueAxisboolean | AxisOptions– True shows the value axis, false hides it, and an options object shows it with those settings. Omit for defaults.
annotationsCartesianAnnotation[]– Positioned annotations for scalar bars.
referencesCategoricalReference[]– Reference lines for scalar bars.
cornerRadiusnumbertheme default Bar end-corner radius.
strokeStroke– Bar stroke color and width.
labelsStackedBarLabels | PositionableBarLabels– Scalar bar labels: stacked content, or simple/grouped content and position.
totalsboolean– Show or hide totals for unnormalized stacked bars. Omit to hide.
linePromotedLine– Draw named series as a line on the same value scale instead of bars or areas. "series" is a non-empty subset of the effective series domain and may not name every series; use type "line" for that. Unavailable on ranged bars and on percent-normalized arrangements.

On this page