Render ECharts to image
echarts_to_imageRender an Apache ECharts option object server-side to PNG, JPEG, WebP, AVIF or SVG without a browser, with themes, background color and raster scale control.
Instructions
Render an Apache ECharts option object server-side (SVG renderer, no browser) and save it as PNG, JPEG, WebP, AVIF or SVG. Supports themes, background color and raster scale.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"option": "<option>"
},
"name": "echarts_to_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scale | No | Raster scale. 2 renders a 2x resolution image. Ignored for SVG output. | |
| theme | No | Built-in theme name (for example dark) or an ECharts theme object. | |
| width | No | Chart width in CSS pixels. Defaults to 1000. | |
| height | No | Chart height in CSS pixels. Defaults to 600. | |
| option | Yes | ECharts option object (the setOption payload). A JSON string is also accepted. | |
| quality | No | Encoder quality (1-100). Applies to JPEG, WebP, AVIF and TIFF output. | |
| lossless | No | Use lossless encoding where supported (WebP and AVIF). | |
| file_name | No | Optional base file name; path separators are not allowed. The actual image format determines the extension. When multiple outputs are produced, -1, -2, ... suffixes are appended. Existing files are never overwritten. | |
| background | No | Chart background color. Defaults to option.backgroundColor, or white. Use transparent for an alpha background. | |
| output_dir | No | Absolute directory where the output file is saved. Defaults to IMG_OUTPUT_DIR, or ~/img-output. The directory is created automatically. | |
| output_format | No | Output format. Defaults to PNG. | png |
| compression_level | No | PNG compression level (0-9); higher is smaller and slower. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| image | Yes | ||
| details | No | ||
| operation | Yes |