chart_from_csv
Parse raw CSV text and generate a chart. Automatically identifies numeric columns for data series and non-numeric columns for labels.
Instructions
Parse raw CSV text and generate a chart directly from it, without requiring the caller to pre-process the data. The tool auto-detects numeric columns for the y-axis and uses the first non-numeric column as x-axis labels. Use this when the user provides CSV content directly; for data already in a Python list or dict use create_chart instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| csv_data | Yes | Complete CSV text including a header row. Columns are auto-classified as labels (non-numeric) or data series (numeric). Newlines should be literal line breaks. Example header row: Month,Sales. | |
| chart_type | No | The type of chart to render. Defaults to 'auto', which picks the best type based on the data shape. See list_chart_types for descriptions of each option. | auto |
| x_column | No | Name of the CSV column to use as x-axis category labels. If omitted, the first non-numeric column is used automatically. Example: 'Month'. | |
| y_columns | No | Names of CSV columns to plot as data series. If omitted, all numeric columns (except x_column) are used. Example: ['Revenue', 'Costs']. | |
| title | No | Optional chart title rendered above the plot area. Example: 'Q1 Sales by Region'. | |
| theme | No | Visual theme. Pass a preset name ('light', 'dark', 'high-contrast') or a palette name ('viridis', 'inferno', etc.) as a string, or a config object. Use list_themes to see all options. | |
| output_format | No | Format for the returned chart: 'svg' (default), 'html', 'data_url' (SVG data URL), or 'png' (rasterized image, requires charted[png]). | svg |
| scale | No | Resolution multiplier for 'png' output. Default 2 gives high-DPI output. Has no effect for SVG formats. | |
| save_path | No | Optional file path to also save the chart on disk. Extension should match output_format, e.g. 'output/chart.svg'. The tool still returns the chart content in the response. |