# Mermaid Pie Chart Cheat Sheet

A labelled list of values, drawn as slices.

## The basic form

One slice per line: a quoted label, a colon, and a positive number. Zero or a negative value fails the diagram.

```mermaid
pie
  "Dogs" : 386
  "Cats" : 85
  "Rats" : 15
```

![A pie chart with three slices labelled Dogs, Cats and Rats, the largest by far.](/diagrams/pie/basic.svg)

## Adding a title

The title goes on the same line as the pie keyword.

```mermaid
pie title Pets adopted by volunteers
  "Dogs" : 386
  "Cats" : 85
  "Rats" : 15
```

![The same pie chart with the title Pets adopted by volunteers above it.](/diagrams/pie/title.svg)

## Showing the numbers

showData prints the value next to each label in the legend.

```mermaid
pie showData
  title Market share
  "Product A" : 45
  "Product B" : 26
  "Product C" : 29
```

![A pie chart whose legend shows the numbers 45, 26 and 29 beside the three product names.](/diagrams/pie/show-data.svg)

## Draw it in Mernyx.

Open a .mmd file, move a node on the canvas, and the source comes with it. Native on macOS, no browser involved.
