Charts CLI
Generate charts from the command line using ECharts. No browser needed.
Usage
List available chart types
charts schema --list
Get schema for a chart type
charts schema bar
charts schema pie
charts schema xAxis
Render a chart
# Pipe JSON config
cat option.json | charts render -o outbox/chart.png
# Or render from file
charts render --config option.json -o outbox/chart.png
Options
| Option |
Description |
-o, --output <file> |
Output path (.svg or .png) |
-W, --width <n> |
Width in pixels (default: 800) |
-H, --height <n> |
Height in pixels (default: 400) |
--theme <name> |
dark, vintage, or path to JSON |
--format <type> |
svg or png (auto-detected from extension) |
Supported chart types
bar, line, pie, scatter, radar, funnel, gauge, treemap, boxplot, heatmap, candlestick, sankey
Visual style rules
Always apply these defaults unless the user asks for something else.
Global defaults
backgroundColor: "#ffffff"
- Title: centered, top 14, fontSize 16, fontWeight bold, color
#111827
- Grid:
{ left: 60, right: 32, top: 60, bottom: 48 }
- Color palette:
#4f46e5, #0d9488, #d97706, #dc2626, #7c3aed, #0891b2
Axis styling
- xAxis: hide ticks, axis line
#d1d5db, label color #4b5563, fontSize 13
- yAxis: hide line + ticks, label color
#9ca3af, dashed split lines #e5e7eb
Bar
barWidth: "50%"
- Rounded top corners:
borderRadius: [5,5,0,0]
- Labels on top
Line
smooth: true
symbol: "circle", symbolSize: 7, line width 3
- Single-series line charts should usually use light area fill
Pie / donut
- No axes
- Use white segment borders
- Prefer
-W 800 -H 500
Scatter
- Both axes
type: "value"
symbolSize: 8, opacity 0.7
Radar / Funnel / Gauge / Heatmap / Sankey / Treemap / Boxplot / Candlestick
Use the same conventions as documented by charts schema and keep styling clean and modern.
Workflow
- Use
charts schema <type> to inspect the config shape
- Build the ECharts JSON option
- Render to a file in
outbox/
- Reply briefly describing the chart so Mercury sends the file back to the user
1---2name: charts-23description: Generate SVG/PNG charts (bar, line, pie, scatter, radar, heatmap, funnel, gauge, sankey, etc.) from ECharts JSON configs4---56# Charts CLI78Generate charts from the command line using ECharts. No browser needed.910## Usage1112### List available chart types1314```bash15charts schema --list16```1718### Get schema for a chart type1920```bash21charts schema bar22charts schema pie23charts schema xAxis24```2526### Render a chart2728```bash29# Pipe JSON config30cat option.json | charts render -o outbox/chart.png3132# Or render from file33charts render --config option.json -o outbox/chart.png34```3536### Options3738| Option | Description |39|--------|-------------|40| `-o, --output <file>` | Output path (`.svg` or `.png`) |41| `-W, --width <n>` | Width in pixels (default: 800) |42| `-H, --height <n>` | Height in pixels (default: 400) |43| `--theme <name>` | `dark`, `vintage`, or path to JSON |44| `--format <type>` | `svg` or `png` (auto-detected from extension) |4546### Supported chart types4748bar, line, pie, scatter, radar, funnel, gauge, treemap, boxplot, heatmap, candlestick, sankey4950## Visual style rules5152Always apply these defaults unless the user asks for something else.5354### Global defaults5556- `backgroundColor: "#ffffff"`57- Title: centered, top 14, fontSize 16, fontWeight bold, color `#111827`58- Grid: `{ left: 60, right: 32, top: 60, bottom: 48 }`59- Color palette: `#4f46e5`, `#0d9488`, `#d97706`, `#dc2626`, `#7c3aed`, `#0891b2`6061### Axis styling6263- xAxis: hide ticks, axis line `#d1d5db`, label color `#4b5563`, fontSize 1364- yAxis: hide line + ticks, label color `#9ca3af`, dashed split lines `#e5e7eb`6566### Bar6768- `barWidth: "50%"`69- Rounded top corners: `borderRadius: [5,5,0,0]`70- Labels on top7172### Line7374- `smooth: true`75- `symbol: "circle"`, `symbolSize: 7`, line width 376- Single-series line charts should usually use light area fill7778### Pie / donut7980- No axes81- Use white segment borders82- Prefer `-W 800 -H 500`8384### Scatter8586- Both axes `type: "value"`87- `symbolSize: 8`, opacity `0.7`8889### Radar / Funnel / Gauge / Heatmap / Sankey / Treemap / Boxplot / Candlestick9091Use the same conventions as documented by `charts schema` and keep styling clean and modern.9293## Workflow94951. Use `charts schema <type>` to inspect the config shape962. Build the ECharts JSON option973. Render to a file in `outbox/`984. Reply briefly describing the chart so Mercury sends the file back to the user