Diverging bars

Use it for change between two periods, such as the themes trending up and down this week compared with last. Rises go right and falls go left from a shared zero line, and the arrow in the label means the direction never depends on colour alone. It is plain HTML, so labels wrap and select.

← All charts

Live demo

Made-up data. Try the options, then switch to the empty and one-point states.

When rows are clickable they are keyboard-focusable: Tab to a row and press Enter.

How to use it

Paste the toolkit from Get the code into your page first, then call the chart like this.

JavaScript
container.append(
  divergingBars([
    { label: 'Certificates', value: 9, sub: 'from 6 to 15 conversations' },
    { label: 'Renewals',     value: 4, sub: 'from 21 to 25' },
    { label: 'Complaints',   value: -7, sub: 'from 11 to 4' }
  ], {
    leftLabel: 'Fewer than last week',
    rightLabel: 'More than last week',
    fmt: v => (v > 0 ? '+' : '−') + Math.abs(v),
    empty: 'Nothing changed this week'
  })
);

Options

What you can pass to this chart.

items

[{ label, value, sub?, tag?, onClick? }]. Positive values go right, negative left; bars scale to the largest change.

fmt

Value formatter (default signed, one decimal).

leftLabel, rightLabel

Headings over the two sides (default Down and Up).

upColour, downColour

Bar colours (default orange for up, blue for down: separable for colour-blind readers).

sort

False keeps your order; the default sorts from the biggest rise to the biggest fall.

empty

Text for the empty state.

Want charts or dashboards like these in your own product?

Tell me what you are trying to see and I can help work out the right approach, from the data behind it to the screen in front of people.