Skip to the page content

Donut charts

Ten ways to show parts of a whole with a Chart.js doughnut, each one colored by your theme.

10 charts

September goals so far

Each ring fills toward 100%; the empty track is what is left to go.

Progress rings

Revenue target

$119k of $140k

Shipped same day

408 of 503 orders

Renewals

218 of 248 accounts

Answered in a day

77 of 120 tickets

Show config
data: { datasets: [{ data: [85, 15], backgroundColor: [series1, track] }] },
options: {
  cutout: '80%',
  plugins: { legend: { display: false }, tooltip: { enabled: false } },
}

Q3 revenue by sales channel

The center shows the Q3 total. Point at a slice or row to see one channel.

Hover label
Show config
options: {
  onHover: (e, active) => showInCenter(active[0]?.index),
}
// From the list: highlight the matching slice
chart.setActiveElements([{ datasetIndex: 0, index }]);
chart.update();

Deliveries on time

Reads like a dial; the mark is the 95% target.

Half-donut gauge
Show config
datasets: [{
  data: [96, 4],
  circumference: 180,
  rotation: 270,
}]

Region mix, quarter by quarter

Q1 inside, Q3 outside. The West grows every quarter.

Concentric rings
  • Northeast
  • Midwest
  • West
  • South
Show config
// The first dataset is drawn outermost
datasets: [
  { label: 'Q3', data: q3 },
  { label: 'Q2', data: q2 },
  { label: 'Q1', data: q1 },
]

Support tickets this week

Rounded ends and small gaps give each status a clear shape.

Rounded segments
  • Solved 77
  • Waiting on customer 22
  • Open 14
  • Escalated 7
Show config
datasets: [{ borderRadius: 8, spacing: 4, borderWidth: 0 }],
options: { cutout: '74%' }

Deal outcomes, Q2 and Q3

Same colors in the same order, so slices match. Centers show win rate.

Side by side
  • Won
  • Lost
  • Pending
  • No decision
Q2 · 96 deals
Q3 · 100 deals
Show config
// Same labels and colors on both charts
const outcomes = { labels: ['Won', 'Lost', 'Pending', 'No decision'] };
new Chart(q2Canvas, { type: 'doughnut', data: { ...outcomes, datasets: [q2] } });
new Chart(q3Canvas, { type: 'doughnut', data: { ...outcomes, datasets: [q3] } });

Accounts by plan

Drag to resize the hole. At 0% it is a pie.

Cutout slider
60%
  • Free 72
  • Basic 88
  • Pro 56
  • Max 32
Show config
slider.addEventListener('input', () => {
  chart.options.cutout = slider.value + '%';
  chart.update('none');
});

September revenue

A small plugin writes the total into the hole.

Center total
  • Booked $119k
  • Still to go $21k
Show config
plugins: [{
  id: 'centerTotal',
  afterDraw({ ctx, chartArea: a }) {
    ctx.fillText('$119k', (a.left + a.right) / 2, (a.top + a.bottom) / 2);
  },
}]

Revenue by category

Slices fade inward; Flat makes them solid.

Gradient fill
  • Travel Planner 48%
  • Customer Portal 31%
  • SMS credits 21%
Show config
backgroundColor: ({ chart, dataIndex }) => {
  const g = chart.ctx.createRadialGradient(cx, cy, inner, cx, cy, outer);
  g.addColorStop(0, tint(series[dataIndex], .45));
  g.addColorStop(1, series[dataIndex]);
  return g;
}

Orders by device

The plainest version: one dataset, defaults.

Basic
  • Phone 58%
  • Desktop 34%
  • Other 8%
Show config
new Chart(canvas, {
  type: 'doughnut',
  data: { labels, datasets: [{ data: [58, 34, 8] }] },
});