BulletChart

One value against a target, on top of bands that say if it is good or bad. Use it for a KPI that has a goal, such as revenue against quota.

It is plain HTML, so it does not need any extra package.

General

The bar is the value, the line is the target and each item of ranges is a band that ends at its own value.

Colors

Set color on a range, and barColor for the bar. Without colors, the bands are shades of the theme gray.

Vertical

Set orientation to vertical and give the track a height.

APIs

BulletChart.Props

AttributeDescriptionTypeAccepted valuesDefault
valuethe current valuenumber--
targetdraw a marker at this valuenumber--
rangesthe bands, each one ends at its valueBulletRange[]BulletRange-
minwhere the scale startsnumber-0
orientationdirection of the chartstring'horizontal', 'vertical'horizontal
sizethickness of the track, in pixelsnumber-28
barSizethickness of the bar, in pixelsnumber-a third of size
heightheight of the track when vertical, in pixelsnumber-200
typetheme color of the barNormalTypes'default', 'primary', 'secondary', 'success', 'warning', 'error', 'info'primary
barColorany CSS color for the bar, replaces typestring--
targetColorcolor of the target markerstring-theme color
labelcontent shown above the chartReactNode--
valueFormatterhow a number is written(value: number) => string-thousands separators, en-US
...native props, passed to the rootHTMLAttributes'aria-label', 'className', ...-

BulletRange

type BulletRange = {
  value: number // where the band ends, it starts where the one before ends
  color?: string // any CSS color, a shade of gray when missing
  label?: string // listed below the chart
}

Ref

The ref points at the root div.

Accessibility

With aria-label or aria-labelledby the root is a meter that exposes the value, the range and a text such as "270, target 250". Without a name it is plain content, because a meter needs one.

Bands are colors, so give each range a label to list what it means as text.

Edit this page on GitHub