create_chart
Generate SVG, HTML, or PNG charts from structured data with 14 chart types including auto-detection. Ideal for visualizing in-memory lists or dicts.
Instructions
Generate an SVG, HTML, data-URL, or rasterized PNG chart from structured data. Supports 14 chart types (bar, column, line, scatter, bubble, pie, polar_area, radar, area, box, histogram, heatmap, gantt, combo) plus 'auto' which picks the best type automatically. Use this when you have data already in memory as a list or dict; for CSV input prefer chart_from_csv instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chart_type | Yes | The type of chart to render. 'auto' inspects the data shape and picks the most appropriate type. Examples: 'bar' for horizontal category comparison, 'line' for time-series trends, 'pie' for part-of-whole proportions, 'scatter' for XY correlation, 'heatmap' for a 2-D color matrix. | |
| data | Yes | Chart data. For a single series pass a 1-D list of numbers, e.g. [10, 20, 15]. For multiple series pass a 2-D list where each inner list is one series, e.g. [[10, 20], [5, 30]]. Scatter/bubble charts expect [[x_values], [y_values]]. | |
| labels | No | Category labels for the x-axis, one per data point. Example: ['Jan', 'Feb', 'Mar']. Omit for numeric or auto-indexed axes. | |
| title | No | Optional chart title rendered above the plot area. Example: 'Monthly Revenue 2024'. | |
| series_names | No | Display names for each data series, shown in the chart legend. Must match the number of series in data. Example: ['Revenue', 'Costs']. | |
| width | No | Chart canvas width in pixels. Default is 500. Increase for more detail or wider labels. | |
| height | No | Chart canvas height in pixels. Default is 500. Adjust to control aspect ratio. | |
| theme | No | Visual theme. Pass a preset name ('light', 'dark', 'high-contrast') or a palette name ('viridis', 'inferno', 'ocean', etc.) as a string, or a config object such as {'colors': 'viridis', 'background_color': '#1a1a2e'}. Use list_themes to see all available options. | |
| output_format | No | Format for the returned chart. 'svg' returns raw SVG markup (default, zero extra dependencies). 'html' wraps the SVG in a minimal HTML page. 'data_url' returns an SVG data URL suitable for use in an img src attribute. 'png' rasterizes the chart to a PNG image (requires charted[png]) and returns it as inline image content visible in chat UIs. | svg |
| scale | No | Resolution multiplier applied when output_format is 'png'. A value of 2 (default) doubles the pixel dimensions for high-DPI displays. Has no effect for SVG output. | |
| save_path | No | Optional absolute or relative file path where the chart should also be saved on disk. The file extension should match output_format (e.g. 'chart.svg' or 'chart.png'). The tool still returns the chart content regardless. |