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

# get_chart_spec_template

> Chart.js v4 templates the agent populates with values from query_ad_metrics.

Returns a populated Chart.js v4 config skeleton for a given chart type. Saves the agent from reinventing the config shape — which is where most malformed-chart errors come from.

## Parameters

| Parameter    | Type   | Required | Description                                                  |
| ------------ | ------ | -------- | ------------------------------------------------------------ |
| `chart_type` | string | Yes      | `line`, `bar`, `pie`, `doughnut`, `radar`, or `stacked_bar`. |

## Output

```json theme={null}
{
  "type": "bar",
  "data": {
    "labels":   ["<x_label_1>", "<x_label_2>"],
    "datasets": [{ "label": "<series_name>", "data": ["<y_value_1>", "<y_value_2>"] }]
  },
  "options": {
    "responsive": true,
    "plugins":    { "legend": { "position": "top" }, "title": { "display": true, "text": "<chart_title>" } },
    "scales":     { "y": { "beginAtZero": true } }
  }
}
```

The agent populates `data.labels` and `data.datasets[].data` from the analytics tool result, then renders inside Ask AI's chart block.
