> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Work with charts

> Save charts from chat, refine them in the chart editor, add filters and keep track of versions.

Every chart in Matys is a SQL query plus a chart type and its settings. You can change any of them by chatting with the Matys AI analyst or by hand.

## Save a chart from chat

Charts in a chat answer are drafts. To keep one, put it on a dashboard.

**1. Click Add to**

**Add to** sits in the chart's title row.

**2. Pick a dashboard**

Choose one under **Recents**, or **New dashboard** to create an *Untitled Dashboard*.

**3. Open the dashboard**

A message confirms *Chart added to …*. Click **Go to dashboard** to open it.

Matys saves a copy of the chart with its own editing chat. Changing the saved chart later does not change the one in the original conversation.

## Quick changes from a chart's menu

Open a chart's menu (**…**) for these actions.

| Action | What it does |
| - | - |
| **Settings** | Opens the settings panel to change the chart type and its options. |
| **Rename** | Edits the chart title in place. |
| **Export** | **Export as CSV…** or **Export as PNG…** |
| **Inspect SQL** | Shows the chart's query, with **Copy SQL**. Available in chat. |
| **Advanced edit mode** | Opens the chart editor with the SQL, the response and the settings. |

A chart whose SQL was changed by hand shows a **SQL edited** badge in chat.

Outside dashboards, a chart with a date filter shows its period and granularity next to the title. Click them to look at another period.

## The chart editor

The chart editor has a chat on the left and the chart on the right. Open it with **Advanced edit mode**, or create a new chart:

* **New chart** in the command palette, or press <kbd>T</kbd>, starts from a chat. Describe the chart and the Matys AI analyst builds it.
* **Run SQL query**, or press <kbd>Q</kbd>, starts with the SQL editor and a table.

See [Navigation](/docs/navigation.md) for the command palette.

> [tab] Iterate by chat
>
> Type what you want changed in *Describe changes to your chart...*. Each change the Matys AI
> analyst makes creates a new version of the chart. The chat lists every version as a card with
> its number, such as **V2**, and marks the **Current version**.

> [tab] Edit the SQL
>
> The **SQL Editor** shows the query and its **Data source**. Edit the query and click **Run** to
> preview the result. If the query fails, a **Query Execution Error** appears with a **Fix with
> AI** button that asks the Matys AI analyst to repair it.

> [tab] Chart or Response
>
> Switch between **Chart** and **Response** above the preview. **Response** shows the rows the
> query returned.

Edits you make by hand stay as a draft. Click **Save** to keep them or **Discard** to drop them. Leaving with unsaved changes asks you to confirm.

The chat panel can be hidden and resized. People with view access see the chart with a **View only** badge and no chat.

## Chart types

Pick the type in the settings panel under **Chart type**. When you switch types, Matys keeps the label and value columns where it can. A type that doesn't fit the data is disabled and says why.

> [accordion] Line / bar
>
> Plots one or more metrics against a **Label column** on the **Horizontal axis**. Each metric can
> be a **Bar**, **Line** or **Area**, on the **Left axis** or **Right axis**. You can **Stack
> bars**, set a **Target** per axis and turn on **Show KPIs**. Needs a label column and a numeric
> column.

> [accordion] Pie
>
> Splits a **Value column** across the slices of a **Label column**. You can choose which
> **Slices** to show. Needs a label column and a numeric column.

> [accordion] Gauge
>
> Shows one **Metric** against a **Range** with a **Minimum** and **Maximum**. Add **Thresholds**
> to mark zones. Each threshold MUST fall inside the range. Needs a numeric column.

> [accordion] KPI
>
> Shows a single number from a **Value** column. Needs a numeric column. The query MUST return a
> single row to switch to KPI.

> [accordion] Table
>
> Shows the rows as a table. Choose which **Columns** to show. Column headers let you sort, filter
> and hide columns.

Numeric values can carry a **Unit**: **None**, **Percent**, **EUR**, **USD** or **GBP**.

## Chart filters

A chart filter, also called a placeholder, lets people change part of the query without editing the SQL. It is the hook that [dashboard filters](/docs/dashboards/filters.md) connect to.

**1. Add the filter**

In the chart editor, click **Add filter** (**+**). Give it a **Filter name** such as `status` or
`region`. It starts with a letter or an underscore and holds only letters, digits and
underscores.

**2. Configure it**

Set a **Label**, a **Type** and an **Operator**, then a **Default Value**. Click **Create**.

**3. Use it in the SQL**

Reference it in the query as `{{ name }}`, for example `WHERE status = {{ status }}`.

| Type | Operators | Extra options |
| - | - | - |
| Text | Equals, Does not equal, Contains, Does not contain, Starts with, Ends with | Single or multiple values, dropdown or free text, static or query-based options |
| Number | `=`, `≠`, `>`, `<`, Between | Single or multiple values, dropdown or free input, static or query-based options |
| Date | `=`, Between, Relative | Relative periods from *Today* to *All time*, and a granularity from hourly to yearly |
| Boolean | Equals | True, False or Any |

Filters show above the chart. Use a filter's menu to edit or remove it.

### Dropdown options

A dropdown filter takes its options from a **Static list** you type, or from a **Dynamic (datasource query)**. A dynamic query returns a `value` column and an optional `label` column, up to 1,000 rows. Click **Validate & preview** to check it.

## Versions

Each change made through chat is a new version. Older versions stay listed in the chart editor chat.

* Click a version card to look at it.
* Click **Restore this version** on the card, or in the top bar while you view it, to make it current again.

You can't edit an older version directly. Restore it first.

## Copy a chart to another dashboard

On a dashboard, open a chart's menu and choose **Copy chart to**. Pick a dashboard or **New dashboard**. Matys saves a separate copy. See [Build a dashboard](/docs/dashboards/build.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.