← 返回
开发者工具 Key 中文

Chart Splat

Generate beautiful charts via the Chart Splat API. Use when the user asks to create, generate, or visualize data as charts, graphs, or plots. Supports line,...
通过 Chart Splat API 生成精美图表。当用户要求创建、生成或可视化数据为图表、图形或绘图时使用。支持折线图、...
bobbyg603
开发者工具 clawhub v1.1.0 1 版本 99805.8 Key: 需要
★ 0
Stars
📥 1,028
下载
💾 68
安装
1
版本
#latest

概述

Chart Splat

Generate beautiful charts from data using the Chart Splat API. Charts are rendered server-side with Chart.js and returned as PNG images.

Supported Chart Types

TypeBest For
----------------
lineTrends over time
barComparing categories
pieParts of a whole
doughnutParts of a whole (with center space)
radarMultivariate comparison
polarAreaComparing categories with radial layout
candlestickFinancial/crypto OHLC price data
ohlcFinancial/crypto OHLC price data (bar variant)

Method 1: CLI (Preferred)

Use the chartsplat CLI via npx. No install required.

npx -y chartsplat-cli bar \
  --labels "Q1,Q2,Q3,Q4" \
  --data "50,75,60,90" \
  --title "Quarterly Revenue" \
  --color "#8b5cf6" \
  -o chart.png

CLI Options

FlagDescription
-------------------
-l, --labels Comma-separated labels
-d, --data Comma-separated numeric values
-t, --title Chart title
--label Dataset label for legend
-c, --color Background color
-w, --width Image width (default: 800)
--height Image height (default: 600)
-o, --output Output file path (default: chart.png)
--config JSON config file for complex charts

CLI Chart Commands

npx -y chartsplat-cli line -l "Mon,Tue,Wed,Thu,Fri" -d "100,200,150,300,250" -o line.png
npx -y chartsplat-cli bar -l "A,B,C" -d "10,20,30" -o bar.png
npx -y chartsplat-cli pie -l "Red,Blue,Green" -d "30,50,20" -o pie.png
npx -y chartsplat-cli doughnut -l "Yes,No,Maybe" -d "60,25,15" -o doughnut.png
npx -y chartsplat-cli radar -l "Speed,Power,Range,Durability,Precision" -d "80,90,70,85,95" -o radar.png
npx -y chartsplat-cli polararea -l "N,E,S,W" -d "40,30,50,20" -o polar.png
npx -y chartsplat-cli candlestick --config ohlc.json -o chart.png

Candlestick Charts

Candlestick and OHLC charts require a JSON config file since the data format is more complex than a simple CSV list. Use --config to provide a file with OHLC data points.

npx -y chartsplat-cli candlestick --config ohlc.json -o candlestick.png

Config format (ohlc.json):

{
  "type": "candlestick",
  "data": {
    "datasets": [{
      "label": "VVV Price",
      "data": [
        { "x": 1740441600000, "o": 4.23, "h": 4.80, "l": 4.10, "c": 4.45 },
        { "x": 1740528000000, "o": 4.45, "h": 5.50, "l": 4.30, "c": 5.34 },
        { "x": 1740614400000, "o": 5.34, "h": 6.20, "l": 5.10, "c": 5.97 }
      ]
    }]
  }
}

Each OHLC data point requires: x (numeric timestamp in ms, or a date string like "2025-02-25"), o (open), h (high), l (low), c (close).

Complex Charts via Config File

For multi-dataset or customized charts, write a JSON config file then pass it to the CLI:

npx -y chartsplat-cli bar --config chart-config.json -o chart.png

See examples/sample-charts.json for config file examples and references/api-reference.md for the full config schema.

Method 2: Helper Script

Use the bundled script for quick generation without installing the CLI:

node scripts/generate-chart.js bar "Q1,Q2,Q3,Q4" "50,75,60,90" "Revenue" chart.png

Or with a config file:

node scripts/generate-chart.js --config chart-config.json -o chart.png

Output Handling

  • Charts are saved as PNG files to the specified output path
  • Default output is chart.png in the current directory
  • For messaging platforms (Discord, Slack), return the file path: MEDIA: /path/to/chart.png
  • The CLI and helper script handle base64 decoding automatically

Error Handling

ErrorCauseFix
-------------------
API key requiredMissing CHARTSPLAT_API_KEYSet the env var in agent config
Invalid API keyWrong or revoked keyGenerate a new key at chartsplat.com/dashboard
Rate limit exceededMonthly quota reachedUpgrade plan or wait for reset
Invalid chart configurationBad request payloadCheck that data.labels and data.datasets are present (candlestick/ohlc only require data.datasets)

Tips

  • Always provide both labels and data arrays of the same length
  • Use hex colors (e.g., #8b5cf6) for consistent styling
  • For pie/doughnut charts, use an array of colors for backgroundColor to color each segment
  • Default dimensions (800x600) work well for most uses; increase for presentations
  • The --config flag accepts any valid Chart.js configuration for full customization

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-03-30 01:59 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,210
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,215
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,807