Back to Resources

AI Chart Generation: How Chion Picks the Right Visualization

How Chion selects from 8 chart types across the line and bar families based on result shape, series count, and scale divergence. Why the SQL is always visible under every chart.

By Jonathan Dag··7 min read

How chart selection works

After SQL execution, Chion evaluates the result shape to select the best chart type. The system scores 8 chart variants across the line and bar families — single line, multi-series line, dual-axis line, stacked area, standard bar, grouped bar, stacked bar, and animated bar race.

Compatibility scoring

Each chart type has a compatibility function that scores the match:

  • ≥0.7: strong match — use this chart
  • ≥0.4: acceptable — use if no stronger match exists
  • <0.4: rejected

Selection is deterministic

Same data shape always produces the same chart type. The fallback chain is: line → bar → scatter → table.

Dual-axis and multi-series

Dual-axis layouts are assigned automatically based on series count and scale divergence. If two metrics have different magnitudes (e.g., revenue in millions vs. count in hundreds), they get separate Y axes.

Why the SQL is always visible

Every chart in Chion shows the exact SQL query underneath. This isn't optional — it's the core design principle. If you can't see the SQL, you can't trust the chart. If you can't trace the number, you shouldn't put it in a slide deck.

Interactive features

All charts support: zoom, pan, tooltip hover, series toggle, responsive resize, and export. Charts are rendered with D3.js for maximum flexibility — no abstraction layer between the data and the pixels.