> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/documentation/use-octoxlabs/dashboards/create-a-dashboard-chart.md).

# Create a dashboard chart

Add a chart to a dashboard, either from saved queries or as a count of assets per value of one field.

A chart turns your asset data into a picture on a dashboard. You build one chart per question, for example "how many devices have no EDR agent compared with all workstations" or "how many devices per operating system".

### Before you begin

* You need a dashboard to put the chart on and the permission to add charts. If you do not see **Add** on the dashboard, ask an administrator.
* For a chart built from queries, create the saved queries first. See Create and Save Queries. A chart can read only saved queries, not a query you have not saved.
* To choose a chart type, see the Chart and widget reference.

### Steps

{% stepper %}
{% step %}

#### Open the dashboard and the Add Chart form

Go to **Dashboards** > **Dashboards** and select the dashboard (and the collection that holds it, if any). Choose **Add** > **Add Chart**. The form opens with a preview pane on the right.
{% endstep %}

{% step %}

#### Name the chart and pick a chart type

Enter a **Chart Name** (required) and, if you like, a **Description**. Pick a **Chart Type**: Number, Percentile, Pie, Polar Area, Bar, Doughnut, Horizontal Bar or Semi Doughnut. If you choose **Percentile**, the form shows a note: scores are calculated against the inventory and shown independently, so they may not add up to 100%. You can change the type later.
{% endstep %}

{% step %}

#### Choose the data

Pick the **Inventory** the chart reads (the default is the Device Inventory), then choose how the chart gets its data.

{% tabs %}
{% tab title="Saved queries" %}
Leave **Group By** off. Search and select a saved query in the query field. Every query you select becomes a row in the table below the form, which shows the **Query Id**, **Name**, **Query Type**, **Color** and **Count** of the query. Each row is one slice, bar or value in the chart.

* Click the colour of a row to change it. The **Color** column header also has a button that generates a new set of colours for all rows.
* Select the same query twice and the form warns that the query already exists. Each query can appear once.
* The query search lists the saved queries of the selected **Inventory**, so choose the inventory first.
  {% endtab %}

{% tab title="Group by a field" %}
Turn **Group By** on. The chart then counts assets per value of one field, so you do not need a saved query for each value.

1. Choose the **Adapter**. The default is the OctoXLabs global fields. Choose an adapter to group by a field that only that adapter provides.
2. Choose the **Group by Field**, for example `Category` or `OS.Type`.
3. Optional: pick a saved query under **Apply Query to Group By Results (Optional)** to count only the assets that match it.
4. Optional: open **Palette** to choose the colours. Pick up to 10 colours, drag the selected ones to reorder them, or use **Randomize**.
   {% endtab %}
   {% endtabs %}

The preview shows "Select query/field to see preview" until you choose a query or a field. It shows "No Group by data to display" or "No data to view" when the result is empty.
{% endstep %}

{% step %}

#### Create the chart

Choose **Create**. OctoXLabs saves the chart and returns you to the dashboard, where the new chart appears. Choose **Cancel** to leave without saving.
{% endstep %}
{% endstepper %}

IMAGEHERE: The Add Chart form with Group By off, two saved queries in the table and the preview pane showing a doughnut chart.

### Verify the result

The chart appears on the dashboard with the name you gave it. Chart counts are updated at the end of every discovery (the discovery steps **Update Query Counts** and **Update Group By Chart Data**), so a chart can lag behind a query that you run now. See Discovery and Aggregation.

### Work with an existing chart

Hover over a chart to open its menu.

| Menu item     | What it does                                                                                                                                                            |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Info          | Shows the creator, who updated the chart last and when, the **Discovery Date** the chart reads (you can switch it to look at an earlier discovery) and the description. |
| **Legend**    | **Show All** or **Hide All** legend entries.                                                                                                                            |
| **Edit**      | Opens the form again. Choose **Save** to apply changes.                                                                                                                 |
| **Duplicate** | Copies the chart to one or more dashboards that you select.                                                                                                             |
| **Populate**  | Copies the chart to other companies. This appears only when you manage more than one company.                                                                           |
| **Delete**    | Deletes the chart after you confirm.                                                                                                                                    |

To move or resize a chart, drag it on the dashboard and choose **Save** when the "Unsaved changes" message appears, or **Discard** to revert. Dragging is disabled while the dashboard is locked. See Dashboard Manager.

### Troubleshooting

| Symptom or message                      | Cause                                                                                     | Fix                                                                                                     |
| --------------------------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| "Query ... already exist"               | You selected a query that is already a row of the chart.                                  | Select a different query, or change the existing row.                                                   |
| "No Group by data to display"           | The field has no values in the selected inventory, or the optional query matches nothing. | Pick another field, or remove or change the query under **Apply Query to Group By Results (Optional)**. |
| "Group by field or labels is required." | The chart has no saved query rows and no group-by field.                                  | Select at least one query, or turn **Group By** on and pick a field.                                    |

### What's next?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Chart and Widget Reference</strong></td><td>All chart types and the 20 prebuilt widgets.</td><td></td></tr><tr><td><strong>Dashboard Manager</strong></td><td>Share, duplicate and organise dashboards.</td><td></td></tr><tr><td><strong>Create and Save Queries</strong></td><td>Build the queries your charts need.</td><td></td></tr></tbody></table>
