skills/bundled/chart-creation/SKILL.md
WPS 图表创建 — AddChart2 方法、图表类型、配色方案、最佳实践
npx skillsauth add claude-office-skills/claude-office-plugin chart-creationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
⚠️ 重要:WPS 加载项中创建图表必须使用 ws.Shapes.AddChart2() 方法! ❌ 禁止使用 ws.ChartObjects.Add()(WPS 中不支持此方法)
AddChart2(Style, XlChartType, Left, Top, Width, Height) 参数:
创建图表后,必须为每条数据系列单独设置颜色,避免默认灰色:
try {
var dataRange = ws.Range("A1:C20");
var lastRow = 20;
var chartTop = (lastRow + 2) * 20;
var shape = ws.Shapes.AddChart2(0, 4, 20, chartTop, 600, 340);
var chart = shape.Chart;
chart.SetSourceData(dataRange);
chart.HasTitle = true;
chart.ChartTitle.Text = "趋势分析";
try {
chart.SeriesCollection.Item(1).Format.Line.ForeColor.RGB = 0xFF4500;
chart.SeriesCollection.Item(1).Format.Line.Weight = 2.5;
chart.SeriesCollection.Item(2).Format.Line.ForeColor.RGB = 0x0000FF;
chart.SeriesCollection.Item(2).Format.Line.Weight = 2.5;
chart.SeriesCollection.Item(3).Format.Line.ForeColor.RGB = 0x00AA00;
chart.SeriesCollection.Item(3).Format.Line.Weight = 2.5;
} catch(ce) {}
try {
chart.SeriesCollection.Item(1).Format.Fill.ForeColor.RGB = 0xE8A040;
} catch(ce) {}
} catch(e) {
ws.Range("F1").Value2 = "趋势";
for (var i = 2; i <= lastRow; i++) {
var cur = ws.Range("B"+i).Value2, prev = ws.Range("B"+(i-1)).Value2;
ws.Range("F"+i).Value2 = cur > prev ? "▲" : (cur < prev ? "▼" : "→");
}
}
| 用途 | BGR 颜色值 | 视觉效果 | |------|-----------|---------| | 系列1(主线/收盘价) | 0xFF4500 | 鲜明蓝 | | 系列2(对比线/开盘价) | 0x0000FF | 红色 | | 系列3(辅助线/均价) | 0x00AA00 | 绿色 | | 系列4(参考线) | 0x00CCFF | 橙色 | | 柱状图(成交量) | 0xE8A040 | 金橙色 | | 涨日柱 | 0x0000FF | 红色 | | 跌日柱 | 0x00AA00 | 绿色 |
⚠️ 图表代码必须包裹在 try/catch 中。颜色设置也要 try/catch。
business
自动生成月度报告工作流
tools
专属助理人格引擎 — 控制助理的身份、口吻和行为风格
tools
首次见面引导 — 在用户完成 Onboarding 后的第一次对话中使用
tools
长记忆管理器 — 隐式学习用户偏好,生成对话摘要