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.
Rendering preview…
pie title Production incidents by root cause
"Config change" : 38
"Dependency outage" : 24
"Code bug" : 21
"Capacity" : 17Sign-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.
Rendering preview…
pie showData
title Sign-ups by browser
"Chrome" : 61.5
"Safari" : 22.3
"Firefox" : 9.1
"Edge" : 7.1Pie Chart syntax cheat sheet
| Syntax | Meaning |
|---|---|
pie | Start a pie chart |
pie title Text | Pie chart with a title |
showData | Show raw values in the legend |
"Label" : 42 | One 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
- Embed Mermaid diagrams in Markdown
- Open the free Mermaid editor to write your own diagram with live preview.
More Mermaid examples
- Mermaid flowchart examples
- Mermaid sequence diagram examples
- Mermaid er diagram examples
- Mermaid class diagram examples
- Mermaid state diagram examples
- Mermaid gantt chart examples
- Mermaid mindmap examples
Last updated 2026-11-28.