Home / Examples / Pie Chart

Mermaid Pie Chart Examples

Mermaid pie charts are the quickest way to show a breakdown in a README, incident review, or report without exporting an image from a spreadsheet.

A pie chart starts with pie, an optional title, and one "Label" : value line per slice. Mermaid converts the values to percentages for you.

Incidents by root cause

The title can go on the same line as pie. Values are counts, and each slice shows its percentage. The numbers here are sample data.

pie title Production incidents by root cause
  "Config change" : 38
  "Dependency outage" : 24
  "Code bug" : 21
  "Capacity" : 17

Sign-ups by browser with showData

showData adds the raw value next to each legend entry. Decimal values are fine. The numbers here are sample data.

pie showData
  title Sign-ups by browser
  "Chrome" : 61.5
  "Safari" : 22.3
  "Firefox" : 9.1
  "Edge" : 7.1

Pie Chart syntax cheat sheet

SyntaxMeaning
pieStart a pie chart
pie title TextPie chart with a title
showDataShow raw values in the legend
"Label" : 42One slice; values must be positive

Common pie chart mistakes

  • Slice labels must be in double quotes.
  • Values must be greater than zero. Remove empty categories instead of writing 0.
  • Too many slices make a pie chart unreadable. Group small categories into "Other".

Pie Chart FAQ

Do the values need to add up to 100?
No. Mermaid adds up all values and shows each slice as a share of the total.
Can I change slice colors?
Yes, with a theme init block such as %%{init: {'themeVariables': {'pie1': '#0ea5e9'}}}%% on the first line.

Keep going

More Mermaid examples

Last updated 2026-11-28.