Skip to documentation content

Bullet Chart

Compare a measure with a target against qualitative ranges, one compact row per metric.

Sales performance against targets

Overview

A bullet chart, designed by Stephen Few, packs a gauge's information into a single row: the measure is a bar, the target is a tick across it, and shaded bands behind it mark qualitative ranges such as poor, satisfactory, and good. Stack several rows to review many metrics in the space of one gauge.

Each row has its own scale, so revenue in thousands, profit in percent, and satisfaction out of five can sit side by side. Do not compare bar lengths between rows; compare each bar with its own target and bands.

Anatomy

BulletChart turns each data row into a bullet with a title, an optional description line, and a scale running from zero to the row's maximum. The maximum is the last range threshold, the value, or the target, whichever is largest, unless maxDataKey sets it. Compose the parts you need: Ranges draws the bands, Measure the bar, Target the tick, and Axis the per-row tick labels. Add Tooltip and Legend for detail.

The bands run from darkest to lightest using shades of the foreground color, as Few recommends, so they stay readable in grayscale and never compete with the measure's color.

Accessibility

The default ariaLabel reads every row's value and target, so a screen reader hears the whole comparison without the canvas. Name ranges with rangeLabels so the tooltip can say which band a value falls in. If being over or under target matters, say it in nearby text too: the tick's position alone is a subtle cue.

Installation

npm install honestui

Usage

import { BulletChart, type ChartConfig } from "honestui/charts";
const data = [
  { metric: "Revenue", unit: "USD, thousands", actual: 271, target: 250, ranges: [150, 225, 300] },
  { metric: "Profit", unit: "%", actual: 22.5, target: 26, ranges: [20, 25, 30] },
];

<BulletChart
  data={data}
  config={chartConfig}
  labelDataKey="metric"
  descriptionDataKey="unit"
  valueDataKey="actual"
  targetDataKey="target"
  rangesDataKey="ranges"
  rangeLabels={["Poor", "Satisfactory", "Good"]}
>
  <BulletChart.Tooltip />
  <BulletChart.Axis />
  <BulletChart.Ranges />
  <BulletChart.Measure />
  <BulletChart.Target />
</BulletChart>

Range thresholds are ascending upper bounds: [150, 225, 300] draws bands from 0 to 150, 150 to 225, and 225 to 300. Give the chart roughly 56px per row with an axis, or 36px without one.

Examples

Compact

No axis, thicker measure

Leave out Axis for a dense tile, and raise the measure's thickness and the target's length so the rows stay legible at a small size. Here every row shares the same thresholds, so one set of range labels describes them all.

Loading State

isLoading='true'

isLoading draws neutral placeholder rows with the shared loading label.

API Reference

BulletChart
PropTypeDefaultDescription
data*TData[]–

One row per bullet.

config*ChartConfig–

Labels and colors for the measure and target keys. Without a target color, the tick uses the foreground color.

labelDataKey*keyof TData & string–

The row title.

valueDataKey*keyof TData & string–

The measure drawn as the bar.

descriptionDataKeykeyof TData & string–

A second line under the title, such as a unit.

targetDataKeykeyof TData & string–

The comparative measure drawn as the tick.

rangesDataKeykeyof TData & string–

A field holding ascending range thresholds.

maxDataKeykeyof TData & string–

A field that sets each row's scale maximum.

rangeLabelsstring[]–

Names for the ranges, from the first threshold up, shown in the tooltip.

labelWidthnumber128

Width of the label column in pixels.

animationbooleantrue

Grows each measure in, row by row. Reduced-motion preferences turn it off.

isLoadingbooleanfalse

Shows placeholder rows and the loading label.

ariaLabelstring–

Accessible name for the canvas. Every row's value and target are read when omitted.

chartOptionsRecord<string, unknown>–

Escape hatch merged over the generated ECharts option.

Measure
PropTypeDefaultDescription
thicknessnumber0.36

Bar thickness as a share of the range band.

radiusnumber1

Corner radius in pixels.

Target
PropTypeDefaultDescription
lengthnumber0.72

Tick length as a share of the range band.

widthnumber2

Tick width in pixels.

Ranges

BulletChart.Ranges takes no props. Include it to draw the qualitative bands.

Axis
PropTypeDefaultDescription
tickCountnumber4

About how many ticks each row shows.

tickFormatter(value: number, rowIndex: number) => string–

Formats tick labels. Receives the row index, since each row can use a different unit.

Tooltip
PropTypeDefaultDescription
valueFormatter(value: number, rowIndex: number) => string–

Formats the value and target.

variantdefault|frosted-glass"default"

Tooltip surface.

roundnesssm|md|lg|xl"lg"

Tooltip corner radius.

Legend
PropTypeDefaultDescription
variantLegendVariant"rounded-square"

Indicator shape.

alignleft|center|right"right"

Horizontal alignment.

verticalAligntop|bottom"top"

Vertical placement.