Klar

Charts / React basic charts / Comparison

Lollipop chart

A stem and a dot per category, sorted, with value labels and one item highlighted; switch the baseline from zero to a target to see who is over and under.

React component Lollipop, data through props. Side by side: who, which source, which version is ahead. Tags: lollipop, ranking, bar alternative, dot plot, deviation, baseline, comparison.

Install

npm i klar-charts

import 'klar-charts/styles.css'
import { ThemeScope, Lollipop } from 'klar-charts'

# or copy the source:
npx shadcn@latest add https://klar.run/r/basic-lollipop.json

Usage

<Lollipop
  data={resolutionByQueue}
  orientation={m === 'cols' ? 'vertical' : 'horizontal'}
  baseline={m === 'sla' ? SLA_HOURS : 0}
  baselineLabel={m === 'sla' ? 'SLA 8 h' : undefined}
  color={m === 'sla' ? 'var(--red)' : 'var(--accent)'}
  belowColor={m === 'sla' ? 'var(--green)' : undefined}
  highlight={m === 'sla' ? undefined : 'Billing disputes'}
  rank={m === 'rank'}
  height={m === 'cols' ? 388 : undefined}
  rowHeight={30}
  valueLabel="Median resolution"
  format={hours}
  ariaLabel="Median time to resolution by support queue, in hours"
/>

Related lollipop charts