← Back to Plugins
Tools

Chart

zhangguiping-xydt By zhangguiping-xydt 👁 19 views ▲ 0 votes

Chart generation plugin for OpenClaw — bar, line, pie, scatter, and area charts as SVG images

GitHub

Install

npm install -g

Configuration Example

{
  "type": "bar",
  "title": "Monthly Revenue",
  "labels": ["Jan", "Feb", "Mar", "Apr"],
  "series": [
    { "label": "Online", "values": [120, 150, 180, 210] },
    { "label": "Retail", "values": [80, 95, 110, 130] }
  ],
  "xLabel": "Month",
  "yLabel": "Revenue (K$)",
  "showLegend": true
}

README

# Chart Plugin for OpenClaw

Generate SVG charts from structured data — bar, line, pie, scatter, and area charts.

## Install

```bash
openclaw plugins install clawhub:chart
```

## Usage

Agent can call the `chart` tool with structured JSON:

```json
{
  "type": "bar",
  "title": "Monthly Revenue",
  "labels": ["Jan", "Feb", "Mar", "Apr"],
  "series": [
    { "label": "Online", "values": [120, 150, 180, 210] },
    { "label": "Retail", "values": [80, 95, 110, 130] }
  ],
  "xLabel": "Month",
  "yLabel": "Revenue (K$)",
  "showLegend": true
}
```

## Chart Types

| Type | Description |
|------|-------------|
| `bar` | Grouped bar chart with multi-series support |
| `line` | Multi-series line chart with data point markers |
| `pie` | Pie chart with percentage labels |
| `scatter` | Scatter plot with multi-series support |
| `area` | Area chart with filled regions |

## Options

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `type` | string | yes | - | Chart type: bar, line, pie, scatter, area |
| `labels` | string[] | yes | - | X-axis labels or pie segment names |
| `series` | object[] | yes | - | Data series array |
| `series[].label` | string | yes | - | Series name shown in legend |
| `series[].values` | number[] | yes | - | Data values, one per label |
| `series[].color` | string | no | auto | Hex color (e.g. #4E79A7) |
| `title` | string | no | - | Chart title |
| `width` | integer | no | 800 | Image width (200-4000) |
| `height` | integer | no | 500 | Image height (200-4000) |
| `xLabel` | string | no | - | X-axis label |
| `yLabel` | string | no | - | Y-axis label |
| `showLegend` | boolean | no | true | Show legend (auto-hidden for single series) |

## Local Development

```bash
cd /path/to/openclaw
ln -sf /path/to/openclaw-chart-plugin extensions/chart
pnpm gateway:dev
```

## Publish to ClawHub

```bash
npm install -g clawhub
clawhub login
clawhub package publish . --dry-run  # preview
clawhub package publish .            # publish
```
tools

Comments

Sign in to leave a comment

Loading comments...