/

Lollipop Chart

A cleaner alternative to bar charts. Thin stems with dot endpoints reduce visual clutter while preserving readability.

ABCDEF020406080100

Quick Start

import { LollipopChart } from "@chartts/react"
 
const data = [
  { country: "Norway", score: 95 },
  { country: "Switzerland", score: 93 },
  { country: "Australia", score: 91 },
  { country: "Ireland", score: 90 },
  { country: "Germany", score: 88 },
  { country: "Iceland", score: 87 },
  { country: "Sweden", score: 86 },
]
 
export function QualityOfLife() {
  return (
    <LollipopChart
      data={data}
      x="country"
      y="score"
      horizontal
      sorted="desc"
      showValues
      className="h-80 w-full"
    />
  )
}

When to Use Lollipop Charts

Lollipop charts are bar charts with less ink. The dot-on-a-stick form is easier to scan when you have many categories.

Use a lollipop chart when:

  • You would use a bar chart, but have many categories and want less visual weight
  • Comparing values across 10 or more items where thick bars become overwhelming
  • Ranking items from highest to lowest
  • You want a modern, minimal aesthetic

Don't use a lollipop when:

  • You have very few categories (bars look better with 3 to 5 items)
  • Showing stacked or grouped data (use bar charts for multi-series)
  • The dot endpoint could be confused with scatter plot data points

Props Reference

PropTypeDefaultDescription
dataT[]requiredArray of data objects
xkeyof TrequiredKey for category labels
ykeyof TrequiredKey for numeric values
colorstringpaletteColor for dots and stems
dotSizenumber8Radius of the endpoint dot in pixels
lineWidthnumber2Thickness of the stem line in pixels
horizontalbooleanfalseRender horizontal lollipops
sortedboolean | 'asc' | 'desc'falseSort by value
showValuesbooleanfalseDisplay value labels
animatebooleantrueAnimate stems and dots on mount
classNamestring-Tailwind classes on root SVG

Horizontal Layout

Horizontal lollipops are the most common layout. Labels read naturally on the left, stems extend right:

<LollipopChart
  data={data}
  x="country"
  y="score"
  horizontal
  sorted="desc"
  showValues
/>

Vertical lollipops work when category labels are short:

<LollipopChart
  data={data}
  x="month"
  y="revenue"
/>

Sorting

Sort lollipops by value for easier comparison:

// Largest first
<LollipopChart data={data} x="name" y="value" sorted="desc" />
 
// Smallest first
<LollipopChart data={data} x="name" y="value" sorted="asc" />
 
// Data order (default)
<LollipopChart data={data} x="name" y="value" sorted={false} />

Sorted horizontal lollipops are the gold standard for leaderboards and rankings.


Dot Size and Line Width

Adjust the visual weight of the chart:

// Subtle (thin stems, small dots)
<LollipopChart data={data} x="name" y="value" dotSize={4} lineWidth={1} />
 
// Standard (default)
<LollipopChart data={data} x="name" y="value" dotSize={8} lineWidth={2} />
 
// Bold (thick stems, large dots)
<LollipopChart data={data} x="name" y="value" dotSize={12} lineWidth={3} />

Larger dots draw more attention to the endpoint values. Thinner stems keep the focus on the dot positions.


Comparison Styling

Color individual lollipops based on their values using conditional styling:

<LollipopChart
  data={data}
  x="metric"
  y="score"
  horizontal
  sorted="desc"
  color={(value) => value >= 80 ? "#10b981" : value >= 60 ? "#f59e0b" : "#ef4444"}
/>

You can also use a fixed color for all lollipops:

<LollipopChart
  data={data}
  x="metric"
  y="score"
  color="#8b5cf6"
/>

Accessibility

  • Each lollipop has an aria-label with the category name and value
  • Keyboard navigation moves between lollipops in display order
  • Screen readers announce each item's label and numeric value
  • The dot endpoint provides a clear focal point beyond just the stem

Real-World Examples

Top performing products

<LollipopChart
  data={products}
  x="name"
  y="unitsSold"
  horizontal
  sorted="desc"
  showValues
  dotSize={10}
  color="#06b6d4"
  className="h-96"
/>

Team velocity comparison

<LollipopChart
  data={teams}
  x="team"
  y="storyPoints"
  horizontal
  sorted="desc"
  showValues
  color={(v) => v >= 40 ? "#10b981" : "#f59e0b"}
  className="h-64"
/>

Feature adoption rates

<LollipopChart
  data={features}
  x="feature"
  y="adoptionPercent"
  horizontal
  sorted="desc"
  showValues
  dotSize={10}
  lineWidth={2}
  className="h-80"
/>

Other Charts