Skip to main content
The chart operation generates data visualizations from your data without external services or client-side rendering. Output as server-rendered SVG (default), QuickChart.io image URLs, or Vega-Lite specs for interactive client-side rendering.
The chart operation is fully Workers-compatible - no DOM, Canvas, or external dependencies. All rendering is pure string manipulation.

Quick Start

Simple bar chart:
Line chart with multiple series:
Pie chart:

Configuration

Chart Types

Bar Chart

Vertical or horizontal bar charts with optional grouping or stacking.
Stacked bar chart:
Horizontal bar chart:

Line Chart

Line charts with single or multiple series, optional smoothing.

Area Chart

Filled area charts with gradient fills, similar to line charts.
Stacked area:

Pie & Donut Charts

Circular charts for showing proportions.
Donut chart (pie with hole in center):

Scatter Plot

Show relationships between two numeric variables.

Sparkline

Minimal inline charts for dashboards and tables.
From objects:

Output Formats

SVG (Default)

Server-rendered SVG string. Best for embedding directly in HTML.

URL (QuickChart.io)

Generate an image URL for use in emails, Slack, etc.
Returns: https://quickchart.io/chart?c={...}
QuickChart URLs are generated client-side. The chart config is URL-encoded, so very large datasets may exceed URL length limits.

Vega-Lite Spec

Generate a Vega-Lite specification for client-side interactive rendering.
Returns a JSON object you can render with Vega-Embed.

HTML

Self-contained HTML document with embedded SVG.
Useful for generating standalone chart pages or PDF conversion.

Theming

Built-in Themes

Custom Colors

Override the color palette:

Reference Lines

Add horizontal reference lines for targets, thresholds, or averages.
Reference lines can also use dynamic values:

Annotations

Add annotations to highlight specific data points or ranges.

Line Annotation

Draw a horizontal or vertical line at a specific value:

Band Annotation

Highlight a range of values:

Point Annotation

Mark a specific point:

Multiple Annotations

Combine multiple annotations:

Auto Detection

Let the chart agent automatically choose the best chart type:
Auto-detection rules:
  • Small categorical data (2-6 items with string + number) → pie
  • Time-series data (date field + numeric) → line
  • Two numeric fields without categories → scatter
  • Single numeric array → sparkline
  • Default → bar

Number Formatting

Format axis values and labels:

Complete Dashboard Example

Performance

Chart generation is fast since it’s pure string manipulation:

Error Handling

Missing Required Fields

Error: chart: bar chart requires config.x and config.y

Invalid Chart Type

Error: chart: invalid type "histogram". Must be one of: bar, line, area, pie, donut, scatter, sparkline

Empty Data

Error: chart: config.data must be a non-empty array
  • transform - Prepare and transform data for charts
  • data - Fetch data from databases
  • http - Fetch data from APIs
  • html - Embed charts in HTML templates
  • pdf - Generate PDF reports with charts