data_chart
Turn a read-only SQL query into a saved bar, line, area, scatter, histogram, pie, or heatmap chart. Returns a JSON summary with chart ID and URL unless image is requested.
Instructions
Draw a chart from a read-only SQL query and save it; only returns the image if you ask.
kind: bar, line, area, scatter, histogram (x only), pie (x = category, y = value), heatmap (x and y). x, y and color are column names of the query result, so aggregate in SQL first, e.g. sql="SELECT region, SUM(amount) AS total FROM sales GROUP BY region", kind="bar", x="region", y="total". bar/line/area without y count rows. Uses at most 5000 rows.
The chart is always saved and logged with its own id, visible in the
app's Work log (its detail view shows the image). include_image
defaults to false and returns only a short JSON summary (id, cite,
row_count, encoding) - a text-only model must not receive an unrequested
image, it can crash the turn. Only set include_image=true when you can
see images and actually need to look at this one; otherwise just tell
the person the returned chart_url (or [id] in the app), or call this again with
include_image=true if you need to read values off the chart yourself.
Keywords: chart, plot, graph, bar chart, line chart, histogram, pie chart, visualize, gráfico, gráfica, gráfico de barras, gráfico de líneas, histograma, gráfico circular, visualizar.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | No | ||
| sql | Yes | ||
| kind | Yes | ||
| color | No | ||
| title | No | ||
| include_image | No |