Diagrams / Mermaid Pie Chart: Syntax & Examples
Mermaid Pie Chart: Syntax & Examples
Create a Mermaid pie chart from labeled values. Edit a budget example, check parts of the whole and decide when a bar chart is clearer.
When to use Pie Chart
Create a Mermaid pie chart when a small number of non-negative categories describe parts of one whole. Use clear labels and a shared unit. If the reader needs to compare nearly equal values precisely, a bar chart is often easier to interpret.
- Start with the example in the editor and identify the elements that answer your question.
- Replace the sample labels and values, previewing after each structural change.
- Review the diagram at its intended reading size, then keep the source and export the format your document accepts.
Read the Pie Chart example
Diagram source
pie title Example project budget
"Design" : 25
"Engineering" : 50
"Testing" : 15
"Documentation" : 10Syntax and interpretation
| Concept | How to apply it |
|---|---|
| Parts of a whole | Categories should describe the same population or budget. Do not combine unrelated totals in one pie. |
| Values | Use non-negative numeric quantities. State the unit and avoid a zero-total dataset. |
| Readability | Limit the number of slices. Grouping tiny categories can help, but explain what an Other category contains. |
Common questions
Do the values have to add up to 100?
They can be counts or amounts representing the same whole. The relative sizes come from their share of the total. If you label values as percentages, verify that the percentage calculation is correct.