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.

Read the Pie Chart example

Diagram source

pie title Example project budget
  "Design" : 25
  "Engineering" : 50
  "Testing" : 15
  "Documentation" : 10
The illustrative budget totals 100 units. Each slice represents one share of that total. These are example values, not measured product usage or market statistics.

Syntax and interpretation

ConceptHow to apply it
Parts of a wholeCategories should describe the same population or budget. Do not combine unrelated totals in one pie.
ValuesUse non-negative numeric quantities. State the unit and avoid a zero-total dataset.
ReadabilityLimit 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.