Install
openclaw skills install @kadbbz/aios-make-chart-imageopenclaw skills install @kadbbz/aios-make-chart-image本技能用于把结构化数据生成 ECharts 图表,并导出为图片文件。优先使用内置脚本 scripts/make_chart_image.mjs,不要在对话中临时拼一个替代渲染脚本。
所有输入文件和输出文件必须遵守 OpenClaw workspace 的 senderId 文件隔离规则。senderId 是生成、下载、上传文件的唯一目录隔离标识;topic_id 不得作为文件目录。图表图片、保存的 ECharts option 和其他渲染中间产物都属于 AI 生成文件,必须写入当前 workspace 的 <senderId>/generated。
aios-transfer-file 返回给用户。node_modules 解析。--sender-id <senderId>;如果无法确认 senderId,停止生成,不得用 topic_id、用户名或推测值替代。<senderId>/generated 目录。<senderId> 目录内的 upload、download 或 generated,或通过 stdin / --data 提供;禁止读取其他 senderId 目录。aios-transfer-file 上传返回。chartType、分类字段和数值字段;字段不明确时说明假设。本技能在 package.json 中声明:
echartssharp首次使用前检查依赖:
cd /path/to/aios-make-chart-image
npm ls echarts sharp --depth=0
如果依赖缺失,在本 skill 目录执行:
npm install
从 JSON 或 Markdown 文件生成 PNG:
node scripts/make_chart_image.mjs --workspace "/abs/path/workspace" --sender-id "<senderId>" --input "<senderId>/upload/data.json" --output "chart.png"
node scripts/make_chart_image.mjs --workspace "/abs/path/workspace" --sender-id "<senderId>" --input "<senderId>/upload/table.md" --output "chart.png" --chart-type line
从 stdin 读取:
cat table.md | node scripts/make_chart_image.mjs --workspace "/abs/path/workspace" --sender-id "<senderId>" --input - --output "chart.png"
保存推断出的 ECharts option 便于审查:
node scripts/make_chart_image.mjs --workspace "/abs/path/workspace" --sender-id "<senderId>" --input "<senderId>/upload/data.md" --output "chart.png" --save-option "chart.option.json"
JSON 输入可以是:
series、xAxis、yAxis 等字段的对象。{ "option": { ... } } 包装形式。[{ "month": "Jan", "sales": 120 }, ...][["month", "sales"], ["Jan", 120]]{ "columns": [...], "rows": [...] }{ "labels": [...], "values": [...] }Markdown 输入使用第一张标准 Markdown 表格,并会尝试从第一个一级/二级标题读取默认标题。
--chart-type auto|bar|line|pie|scatter,默认 auto。--title "标题",覆盖输入里的标题。--width 1200 --height 800,默认 1200x800。--format png|svg|jpg|jpeg|webp,未指定时从输出扩展名推断。--workspace "/abs/path/workspace",当前 agent workspace 根目录。--sender-id "<senderId>",当前通道提供的文件隔离标识,必填。--x field,指定分类字段。--y field1,field2,指定数值字段。--name field --value field,指定饼图字段。--theme light|dark,默认 light。--save-option file.json,保存最终 ECharts option。脚本成功后会在 stdout 输出 JSON,至少包含:
outputformatwidthheightchartType如果脚本失败,读取 stderr 的真实错误并据实报告,不要声称图片已生成。
脚本成功后,output 和可选的 option 路径必须位于当前 <senderId>/generated 内;如果不是,视为违反文件隔离规则,不得继续使用或发送该文件。