create_chart_from_spec
PREFERRED chart-creation path. Send a structured Builder spec (chart_type + x_col + y_col[s] + optional group_by, palette, axis overrides, annotations) and Autario builds the chart with the same templates the Builder UI uses. Brand attribution (publisher source + autario.com) is applied automatically and cannot be overridden. Insight must cite numbers verifiable against the data | hallucinated numbers return 422 with the available anchor list. For advanced use cases the Builder cannot express, fall back to publish_chart with a freeform plotly_spec. Call chart_instructions() first if unsure of the spec shape.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | No | Chart title (also settable via builder_spec.title; this top-level wins if both set). Format: "{Topic} | {Scope} ({YYYY-YYYY}, {unit})". The YYYY-YYYY year range is REQUIRED whenever the chart has a time axis (pull from the actual data span you queried). The unit is REQUIRED whenever get_dataset_info → unit is a non-empty string (copy verbatim, e.g. "Mt CO2e", "% of GDP", "per 1,000 live births"). If get_dataset_info → unit is null/empty, omit the unit | NEVER invent one. Example with both: "Greenhouse Gas Emissions by Country (2010-2024, Mt CO2e) | World Bank". Example unit-only: "Infant Mortality by Race (per 1,000 live births) | NCHS". | |
| insight | No | 2-3 sentence data insight using ONLY numbers from query_dataset/get_dataset_schema results. Hallucinated numbers are rejected with the available anchor list. | |
| narration | No | Longer description (optional, defaults to insight) | |
| dataset_ids | Yes | UUID array of datasets backing this chart. Autario pulls real data from these tables. | |
| builder_spec | Yes | Structured Builder spec. Required: chart_type + x_col + y_col/y_cols (axis charts), label_col + value_col (pie/donut), x_col + group_by + value_col (heatmap). Optional: group_by, group_values, facet_by/facet_values (donut grid), heatmap_scale, title, palette/color_scheme, axis (x_title, y_title, y_min, y_max, log_scale, y_format, tick_angle, x_date_format), annotations, event_bands, overlays, legend_pos, bg_color, font_color, chart_height. See chart_instructions() for full reference. |