> For the complete documentation index, see [llms.txt](https://docs.kognitos.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kognitos.com/legacy/legacy-experience/automation-areas/charts/add-legend.md).

# Add Legend

Enables a legend on an existing pie chart.

### Overview

This procedure adds a legend to a **pie chart** that has already been created. Legends are only supported for pie charts and will display the category names alongside the chart slices.

### Syntax

Below is a line-by-line overview of the automation syntax. Expand each line to learn more.

<details>

<summary><code>add a legend to the chart</code></summary>

#### What does it do?

Enables the legend display on the current pie chart.

#### Where does it go?

This phrase should be written on a **new line**.

#### Is it required?

✅ Yes — This phrase is **required**.

#### Does it require data?

✅ Yes — A reference to **the chart** must be defined in the automation.

</details>

### Examples

#### 1. Add Legend to Pie Chart

```
create a pie chart where
    the categories are ["Desktop", "Mobile", "Tablet"]
    the values are [52.3, 35.8, 11.9]
    the title is "Website Traffic Sources"
    the style is "white"
add a legend to the chart
show the chart
```
