pie showData
title Documentation effort
"Writing" : 48
"Review" : 32
"Publishing" : 20 Loading…
Mermaid 11.15.0
Pie charts compare a few positive parts of one total. Choose a bar chart for many categories or close values, and a quadrant chart for comparing two independent dimensions.
Build this in Pie Chart Maker →Values are weights, not percentages that must add to 100. Mermaid calculates each share of the total.
pie showData
title Documentation effort
"Writing" : 48
"Review" : 32
"Publishing" : 20 Loading…
| Syntax | Meaning |
|---|---|
| pie / pie showData | Declare a pie chart; showData adds raw values to the legend. |
| title Text | Add an optional heading. |
| "Label" : 12.75 | Use quoted labels and positive numeric weights. Two decimal places are the documented precision. |
| config.pie.textPosition: 0.75 | Place slice text radially: 0 is the center, 1 is the outer edge. |
| themeVariables.pieOuterStrokeWidth: "2px" | Set the width of the chart’s outer border. |
| themeVariables.pie1…pie12 | Set the palette’s slice colors using the base theme. |
| pieTitleTextSize / pieTitleTextColor / pieSectionTextSize / pieSectionTextColor | Theme variables for the heading and slice labels. |
| pieLegendTextSize / pieLegendTextColor / pieStrokeColor / pieStrokeWidth / pieOuterStrokeColor / pieOpacity | Theme variables for legend text, slice borders, outer border and opacity. |
| %% / accTitle: / accDescr: | Add comments and accessible descriptions. |
Keep source values positive. Use a dot as the decimal separator, even in languages that normally display a comma. showData displays the supplied weights in the legend; slice labels round percentages to whole numbers. In Mermaid 11.15, slices below 1% are hidden, although their legend entries remain.
pie showData
title Editing hours
"Drafting" : 12.75
"Fact checking" : 6.25
"Proofreading" : 3.50 Loading…
Keep category names short so the legend remains readable. Without showData, the legend lists the names while slice text still represents proportions. Avoid many tiny categories.
pie
title Review outcomes
"Accepted" : 18
"Revised" : 7
"Deferred" : 3 Loading…
TextPosition is a radial ratio, not a pixel distance. A smaller value moves labels toward the center. Very narrow slices can still overlap; simplify the data before adjusting appearance.
---
config:
pie:
textPosition: 0.6
---
pie showData
title Review split
"Technical" : 60
"Editorial" : 40 Loading…
Use theme base before customizing pie1 through pie12. Set pieOuterStrokeWidth as a CSS length. Match text and border colors to the background; the palette does not make closely sized slices easier to compare.
---
config:
theme: base
themeVariables:
pie1: "#d3e5ff"
pie2: "#50e3c2"
pie3: "#f5f5f5"
pieOuterStrokeWidth: "2px"
pieSectionTextColor: "#171717"
---
pie showData
title Work allocation
"Research" : 45
"Writing" : 35
"Review" : 20 Loading…
Negative numbers are rejected. Use a positive value; a pie cannot represent a net loss.
Invalid syntax — corrected example below
pie
"Review" : -2pie
"Review" : 2
"Writing" : 8 Loading…
Write 12.75, not 12,75. Round source data to two decimal places for the documented notation.