# Create Chart

### Overview

This procedure creates categorical data visualizations. Bar charts display categories along one axis with corresponding values, and can be oriented horizontally or vertically. Pie charts show proportional relationships as slices of a circle. Legends are supported only for pie charts.

### Syntax

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

<details>

<summary><code>create a {bar|pie} chart where</code></summary>

#### What does it do?

Begins a chart definition block.

#### 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 — Replace the adjective with **bar** or **pie**.

#### Example

```
create a bar chart where
```

</details>

<details>

<summary><code>the categories are c</code></summary>

#### What does it do?

Provides category labels for the chart.

#### Where does it go?

Indented under `create a {bar|pie} chart where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **c** with a list of texts or a reference to table data.

#### Example

```
the categories are the table's cities
```

</details>

<details>

<summary><code>the values are v</code></summary>

#### What does it do?

Provides numeric values corresponding to each category.

#### Where does it go?

Indented under `create a {bar|pie} chart where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **v** with a list of numbers or reference to table data.

#### Example

```
the values are the table's populations
```

</details>

<details>

<summary><code>the title is "chart-title"</code></summary>

#### What does it do?

Sets the chart title.

#### Where does it go?

Indented under `create a {bar|pie} chart where`.

#### Is it required?

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

#### Does it require data?

✅ Yes — Replace **chart-title** with a text string.

#### Example

```
the title is "Population of Cities"
```

</details>

<details>

<summary><code>the x label is "x-label"</code></summary>

#### What does it do?

Labels the x-axis.

#### Where does it go?

Indented under `create a bar chart where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **x-label** with a text string to label the x-axis. The default is `Categories`.

#### Example

```
the x label is "Cities"
```

</details>

<details>

<summary><code>the y label is "y-label"</code></summary>

#### What does it do?

Labels the y-axis.

#### Where does it go?

Indented under `create a bar chart where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **y-label** with a text string to label the y-axis. The default is `Values`.

#### Example

```
the y label is "Population"
```

</details>

<details>

<summary><code>the orientation is "{horizontal|vertical}"</code></summary>

#### What does it do?

Sets bar chart orientation.

#### Where does it go?

Indented under `create a bar chart where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Set the text as either `horizontal` or `vertical`. The default is `vertical`.

#### Example

```
the orientation is "horizontal"
```

</details>

<details>

<summary><code>the legend is "{enabled|disabled}"</code></summary>

#### What does it do?

Displays a legend with category names.

#### Where does it go?

Indented under `create a pie chart where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Set the text as either `enabled` or `disabled`. The default is `disabled`.

#### Example

```
the legend is "enabled"
```

</details>

<details>

<summary><code>the color palette is "color-palette"</code></summary>

#### What does it do?

Sets the color scheme for the chart.

#### Where does it go?

Indented under `create a {bar|pie} chart where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **color-palette** with one of `kognitos`,`lavender`, `rocket`, or any [HTML named color](https://developer.mozilla.org/en-US/docs/Web/CSS/named-color) (e.g., `red`, `blue`, `green`, `purple`, `orange`, etc.). The default is `kognitos`.

#### Example

```
the color palette is "blue"
```

</details>

<details>

<summary><code>the style is "chart-style"</code></summary>

#### What does it do?

Sets the seaborn chart style.

#### Where does it go?

Indented under `create a {bar|pie} chart where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **chart-style** with one of `white`, `darkgrid`, `whitegrid`, `dark`, `ticks`. The default is `white`.

#### Example

```
the style is "white"
```

</details>

<details>

<summary><code>the font is "font-name"</code></summary>

#### What does it do?

Sets the font family for all text.

#### Where does it go?

Indented under `create a {bar|pie} chart where`.

#### Is it required?

❌ No — This phrase is **optional**.

#### Does it require data?

✅ Yes — Replace **font-name** with a font name. The default is `Raleway Light`.

#### Example

```
the font is "Raleway Light"
```

</details>

### Examples

#### 1. Bar Chart with Direct Values

```
create a bar chart where
    the categories are ["New York", "Los Angeles", "Chicago", "Houston"]
    the values are [8419000, 3980000, 2716000, 2328000]
    the title is "Population of Major Cities"
    the x label is "Cities"
    the y label is "Population"
    the style is "white"
```

#### 2. Pie Chart with Legend

```
create a pie chart where
    the categories are ["Desktop", "Mobile", "Tablet"]
    the values are [45.2, 35.8, 19.0]
    the title is "Traffic Sources"
    the legend is "enabled"
    the color palette is "blue"
```

#### 3. Horizontal Bar Chart from Table Data

```
create a bar chart where
    the categories are the table's departments
    the values are the table's budgets
    the title is "Department Budgets"
    the orientation is "horizontal"
    the x label is "Budget ($)"
    the y label is "Department"
```

#### 4. Pie Chart with color palette

```
create a pie chart where
    the categories are ["Marketing", "Sales", "Support", "Engineering"]
    the values are [30, 25, 20, 25]
    the title is "Team Distribution"
    the legend is "enabled"
    the color palette is "orange"
    the style is "white"
```
