Example
pie title MermanDraw Users by Type
"Flowchart" : 48
"Sequence" : 22
"ER / Class" : 18
"Others" : 12 Syntax
Basic chart
pie showData
title Traffic by source
"Organic search" : 412
"Direct" : 190
"Referral" : 88
"Social" : 54 showData after pie prints the raw value next to each percentage. Labels must be quoted; values can be decimals.
Common mistakes
These are the parse errors that come up most, including in code written by ChatGPT and Claude. Paste any failing diagram into the editor and it marks the offending line.
-
Unquoted labels (
Organic : 412).Fix: Wrap every label in double quotes.
-
Percent signs in values (
"A" : 40%).Fix: Write plain numbers. Mermaid computes percentages itself.
-
A
titleline beforepie.Fix:
piemust be the first token. Puttitleon the next line (or on the same line afterpie).
Real-world examples
Complete, copy-ready pie charts for common situations. Each one opens in the editor with a click.
Browse all examples →FAQ
Can I change slice colours?
Through theme variables pie1 to pie12, which MermanDraw's themes set for you. Inline per-slice colours are not supported in the diagram text.
Can I make a donut chart?
No. Mermaid pies are full circles. For a donut, export the SVG and edit it, or use an XY chart.