chart
它能做什么
它指导智能体使用图表工具,把数据展示为柱状图、折线图、饼图或散点图等。适合希望在 AI 编程环境中看到数字可视化效果的人。
适用场景
- ✓当你明确要求把某些数据绘制为图表、图形或曲线时。
- ✓当你希望把趋势或比较显示为柱状图、折线图或饼图时。
- ✓当你需要关系或流程图时,它会以 mermaid 图的形式编写,而不是图表。
技能链接
https://github.com/Kilo-Org/kilocode/blob/main/.kilo/skills/chart/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把我每月的销售数字绘制成折线图,让我看到趋势。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体为数据选择受支持的图表类型,把数据和标签交给图表工具,并由该工具完成渲染。流程图等图示以文本代码块的形式编写,而不是图表。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Data Visualization
The chart tool is ALWAYS available in this environment. When the user asks to visualize data (charts, graphs, plots), you MUST call the chart tool. Never output the config as text, never say the tool is unavailable, never suggest external renderers. Always use the tool call — it is the only correct response for data visualization requests. Do NOT repeat or echo the config JSON in your text response.
Use the chart tool only when the user explicitly asks for a chart, graph, or plot. Only use these supported Chart.js v4 types: bar, bubble, pie, doughnut, line, mixed, polarArea, radar, scatter. For area charts, use line with fill: true on the dataset — do NOT use area as a type.
Use mermaid fenced code blocks (```mermaid) when:
- The user asks for a diagram, flowchart, sequence diagram, ER diagram, or architecture diagram
- Visualizing relationships, processes, or structure — not data values
Mermaid is NOT a tool and is NOT Chart.js — never call the chart tool for mermaid diagrams. Just write the mermaid syntax directly in your text response inside a fenced code block. No tool call needed.
Do not use either for: code, text, or data that is already clear in prose or table form.
The chart tool input accepts:
title(string) — short label shown in the tool headerdescription(string, optional) — subtitle shown below the titlespec(string) — a Chart.js config object as a JSON string
The spec field must be a Chart.js config JSON string with type, data, and optionally options. Examples:
Bar chart:
{
"type": "bar",
"data": {
"labels": ["A", "B", "C"],
"datasets": [{ "label": "Value", "data": [10, 20, 15] }]
}
}
Area chart (line with fill):
{
"type": "line",
"data": {
"labels": ["Jan", "Feb", "Mar", "Apr"],
"datasets": [{ "label": "Value", "data": [10, 28, 19, 45], "fill": true }]
}
}
Line chart:
{
"type": "line",
"data": {
"labels": ["Jan", "Feb", "Mar", "Apr"],
"datasets": [{ "label": "Value", "data": [10, 28, 19, 45], "fill": false }]
}
}
Scatter plot:
{
"type": "scatter",
"data": {
"datasets": [{
"label": "Points",
"data": [{ "x": 1, "y": 5 }, { "x": 2, "y": 8 }, { "x": 3, "y": 3 }]
}]
}
}
Time series:
{
"type": "line",
"data": {
"labels": ["2024-01", "2024-02", "2024-03", "2024-04"],
"datasets": [{ "label": "Value", "data": [120, 145, 132, 178], "fill": true }]
}
}
Pie chart:
{
"type": "pie",
"data": {
"labels": ["A", "B", "C"],
"datasets": [{ "data": [30, 50, 20] }]
}
}
Doughnut chart:
{
"type": "doughnut",
"data": {
"labels": ["A", "B", "C"],
"datasets": [{ "data": [30, 50, 20] }]
}
}
Radar chart:
{
"type": "radar",
"data": {
"labels": ["Speed", "Power", "Agility", "Stamina"],
"datasets": [{ "label": "Player", "data": [80, 60, 90, 70] }]
}
}
Bubble chart:
{
"type": "bubble",
"data": {
"datasets": [{
"label": "Group A",
"data": [{ "x": 10, "y": 20, "r": 8 }, { "x": 15, "y": 10, "r": 5 }]
}]
}
}
Polar area chart:
{
"type": "polarArea",
"data": {
"labels": ["A", "B", "C", "D"],
"datasets": [{ "data": [11, 16, 7, 14] }]
}
}
Mixed chart (bar + line):
{
"type": "bar",
"data": {
"labels": ["Jan", "Feb", "Mar"],
"datasets": [
{ "type": "bar", "label": "Revenue", "data": [100, 120, 90] },
{ "type": "line", "label": "Trend", "data": [95, 115, 100] }
]
}
}
You may customize colors by setting backgroundColor and borderColor arrays on datasets. The renderer handles sizing — do not set width or height.
Only include scales in options for cartesian chart types: bar, line, scatter, bubble. Do NOT include scales for pie, doughnut, polarArea, radar, or mixed — it will cause them to fail.
常见问题
支持哪些图表类型?
柱状图、气泡图、饼图、环形图、折线图、混合图、极区图、雷达图和散点图。
我如何制作面积图?
使用折线图,并为数据集开启填充选项。
它能画流程图吗?
流程图和示意图以 mermaid 代码的形式编写,而不是图表工具的输出。
详情
作者的原始描述
Use when the user asks to visualize data with charts, graphs, or plots using the `chart` tool (bar, line, scatter, pie, time series, etc.).
repo: Kilo-Org/kilocode
热度
- GitHub 星标
- 28k
- 排名
- #9872
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …