Honest Bar

A bar chart that admits when its axis doesn't start at zero and says how much that exaggerates, like "looks 3×, really 1.09×".

StopsBar chart made 9% look like 3×

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/honest-bar.json

The files land in your project. They're yours to edit.

Usage

honest-bar-usage.tsx
import { HonestBar } from "@/components/ui/honest-bar"

<HonestBar label="Monthly active users" data={users} min={9000} />

What it catches

  • Truncated value axis that makes small differences look large
  • Values clipped past the scale: torn and labelled
  • Exaggeration stated as drawn ratio vs real ratio

Props

HonestBar props
PropTypeDefault
data* (required)

Bars, in order.

HonestBarDatum[]—
label* (required)

Accessible name of the chart, also shown as its caption.

string—
orientation

"vertical" columns (default) or "horizontal" bars.

"vertical" | "horizontal""vertical"
min

Where the value axis starts. Above zero triggers the truncation warning and broken-axis mark.

number—
max

Where the value axis ends. Values past it are drawn torn and labelled with their real value.

number—
size

Plot height in px (vertical) or height per bar (horizontal).

number—
format

Short format for ticks and labels.

(value: number) => string(v) => compact.format(v)
exactFormat

Exact format for the hover/focus readout.

(value: number) => string(v) => exact.format(v)
truncatedText

Templates: `{min}`, `{drawn}`, `{real}` and `{count}` are filled in.

string"The axis starts at {min}, not 0: the longest bar looks {…
cutOffText

Label for a bar that runs past the scale.

string"The axis starts at {min}, not 0, so bar lengths aren't p…
clippedText

Message when bars are clipped at max.

string"{count} past the edge of the scale, labelled with the re…
fixLabel

Button text that resets the axis to start at 0.

string"Start at 0"
undoLabel

Button text that restores the original axis.

string"Undo"

* required. Also accepts the native props of <figure> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Chart is a labelled list; each bar is a focusable listitem with an aria-label holding the exact value
  • Arrow keys, Home and End move between bars
  • Status about truncation is in a polite live region
  • The broken-axis warning has text, not only a visual mark

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

  • One series of bars; not a general charting library
  • The lie factor compares longest and shortest bars only
  • Ignores other distortions such as 3D, dual axes or log scales

What it stops

Bar chart made 9% look like 3×

Also known as

bar chart · y axis · start at zero · broken axis · svg chart · data viz · dashboard · recharts

Field type

Dependencies

Pairs well with