Chart generation

Wren AI offers powerful visualization capabilities that transform your data into insightful charts through a simple API interface. Generate interactive charts — Apache ECharts on v2 or Vega-Lite on v1 — directly from natural language questions and SQL queries.

Project availability: ✅ Classic projects • ✅ Agentic projects

Chart generation works for both project types. New projects (classic and agentic) render charts as Apache ECharts via /v2/generate_chart; pre-existing projects continue to use Vega-Lite via the legacy /v1/generate_vega_chart.

Endpoint Overview

  • POST /v2/generate_chart: Generate an Apache ECharts option with the executed rows embedded in dataset.source for visualization. Recommended.
  • POST /v1/generate_vega_chart: Generate a complete Vega-Lite specification with embedded data for visualization. (Legacy — v1 only.)

Chart Generation Workflow

The chart generation process follows a simple flow:

  1. Ask a question via /v2/generate_sql to get SQL
  2. Request a visualization with your question and SQL — via /v2/generate_chart (ECharts) or /v1/generate_vega_chart (Vega-Lite)
  3. Render the returned chart specification in your application