← 返回 Skills 市场
109
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install chart-toolkit
功能描述
Create and export various charts (line, bar, pie, candlestick, heatmap), dashboards, and HTML reports with real-time data updates and automatic refreshing.
使用说明 (SKILL.md)
Data Visualization - 数据可视化仪表盘\r
\r
图表生成/仪表盘制作/实时数据看板/自动报告\r 最后更新:2026-04-13\r \r ---\r \r
功能概述\r
\r
- 📊 图表生成:折线/柱状/饼图/热力图\r
- 📈 K线图表:股票/期货专用图表\r
- 🖥️ 仪表盘:多图表组合看板\r
- 🔄 实时更新:数据自动刷新\r
- 📝 报告导出:PDF/HTML/PNG\r \r ---\r \r
图表生成\r
\r
1. Matplotlib基础图表\r
import matplotlib.pyplot as plt\r
import matplotlib\r
matplotlib.use('Agg') # 非交互式后端\r
\r
# 设置中文\r
plt.rcParams['font.sans-serif'] = ['SimHei', 'Arial']\r
plt.rcParams['axes.unicode_minus'] = False\r
\r
def plot_line(data, title, xlabel, ylabel, output='chart.png'):\r
"""折线图"""\r
plt.figure(figsize=(12, 6))\r
plt.plot(data['x'], data['y'])\r
plt.title(title)\r
plt.xlabel(xlabel)\r
plt.ylabel(ylabel)\r
plt.grid(True)\r
plt.savefig(output, dpi=100, bbox_inches='tight')\r
plt.close()\r
return output\r
\r
def plot_bar(categories, values, title, output='bar.png'):\r
"""柱状图"""\r
plt.figure(figsize=(12, 6))\r
plt.bar(categories, values)\r
plt.title(title)\r
plt.xticks(rotation=45)\r
plt.tight_layout()\r
plt.savefig(output, dpi=100)\r
plt.close()\r
return output\r
\r
def plot_pie(sizes, labels, title, output='pie.png'):\r
"""饼图"""\r
plt.figure(figsize=(8, 8))\r
plt.pie(sizes, labels=labels, autopct='%1.1f%%')\r
plt.title(title)\r
plt.savefig(output)\r
plt.close()\r
return output\r
```\r
\r
### 2. K线图表\r
```python\r
import mplfinance as mpf\r
\r
def plot_candlestick(data, title='K线图', output='candle.png'):\r
"""K线图"""\r
# data需要包含: Date, Open, High, Low, Close, Volume\r
mpf.plot(\r
data.set_index('Date'),\r
type='candle',\r
title=title,\r
style='charles',\r
savefig=output\r
)\r
return output\r
\r
def plot_volume(data, output='volume.png'):\r
"""成交量图"""\r
mpf.plot(\r
data.set_index('Date'),\r
type='line',\r
volume=True,\r
savefig=output\r
)\r
return output\r
```\r
\r
### 3. 热力图\r
```python\r
import seaborn as sns\r
import numpy as np\r
\r
def plot_heatmap(data, title, output='heatmap.png'):\r
"""热力图"""\r
plt.figure(figsize=(12, 8))\r
sns.heatmap(data, annot=True, fmt='.2f', cmap='YlOrRd')\r
plt.title(title)\r
plt.tight_layout()\r
plt.savefig(output)\r
plt.close()\r
return output\r
\r
def correlation_matrix(df, output='corr.png'):\r
"""相关系数矩阵"""\r
plt.figure(figsize=(10, 8))\r
sns.heatmap(df.corr(), annot=True, cmap='coolwarm', center=0)\r
plt.title('Correlation Matrix')\r
plt.savefig(output)\r
plt.close()\r
return output\r
```\r
\r
---\r
\r
## 仪表盘制作\r
\r
### 1. 多图表组合\r
```python\r
from matplotlib.gridspec import GridSpec\r
\r
def create_dashboard(data, output='dashboard.png'):\r
"""创建仪表盘"""\r
fig = plt.figure(figsize=(16, 10))\r
gs = GridSpec(3, 2, figure=fig)\r
\r
# 图1:K线\r
ax1 = fig.add_subplot(gs[0, :])\r
mpf.plot(data['kline'], type='candle', ax=ax1, show=False)\r
\r
# 图2:成交量\r
ax2 = fig.add_subplot(gs[1, 0])\r
ax2.bar(data['volume']['date'], data['volume']['vol'])\r
ax2.set_title('Volume')\r
\r
# 图3:资金流\r
ax3 = fig.add_subplot(gs[1, 1])\r
ax3.plot(data['money_flow'])\r
ax3.set_title('Money Flow')\r
\r
# 图4:收益曲线\r
ax4 = fig.add_subplot(gs[2, :])\r
ax4.plot(data['equity'])\r
ax4.set_title('Equity Curve')\r
\r
plt.tight_layout()\r
plt.savefig(output, dpi=100)\r
plt.close()\r
return output\r
```\r
\r
### 2. 实时看板\r
```python\r
import time\r
\r
class LiveDashboard:\r
"""实时看板"""\r
\r
def __init__(self, refresh_interval=60):\r
self.refresh_interval = refresh_interval\r
self.data_sources = {}\r
\r
def add_source(self, name, func):\r
"""添加数据源"""\r
self.data_sources[name] = func\r
\r
def update(self):\r
"""更新所有数据"""\r
results = {}\r
for name, func in self.data_sources.items():\r
try:\r
results[name] = func()\r
except Exception as e:\r
print(f"Failed to update {name}: {e}")\r
return results\r
\r
def run(self, duration=3600):\r
"""运行看板"""\r
start = time.time()\r
while time.time() - start \x3C duration:\r
data = self.update()\r
self.render(data)\r
time.sleep(self.refresh_interval)\r
```\r
\r
---\r
\r
## HTML看板\r
\r
### 1. Plotly交互图\r
```python\r
import plotly.express as px\r
import plotly.graph_objects as go\r
from plotly.subplots import make_subplots\r
\r
def create_html_dashboard(data):\r
"""创建HTML仪表盘"""\r
fig = make_subplots(\r
rows=2, cols=2,\r
subplot_titles=('K线', '成交量', '资金流', '收益曲线')\r
)\r
\r
# K线\r
fig.add_trace(\r
go.Candlestick(x=data['date'], open=data['open'], \r
high=data['high'], low=data['low'], close=data['close']),\r
row=1, col=1\r
)\r
\r
# 成交量\r
fig.add_trace(\r
go.Bar(x=data['date'], y=data['volume']),\r
row=1, col=2\r
)\r
\r
# 收益曲线\r
fig.add_trace(\r
go.Scatter(x=data['date'], y=data['equity'], name='Equity'),\r
row=2, col=1\r
)\r
\r
fig.update_layout(height=800, showlegend=True)\r
\r
html = fig.to_html(full_html=False)\r
return html\r
```\r
\r
### 2. 数据表格\r
```python\r
def create_data_table(data, columns, title='数据表'):\r
"""创建数据表格HTML"""\r
html = f'''\r
\x3Ch3>{title}\x3C/h3>\r
\x3Ctable style="width:100%; border-collapse: collapse;">\r
\x3Ctr style="background:#f0f0f0;">\r
{"".join([f"\x3Cth>{c}\x3C/th>" for c in columns])}\r
\x3C/tr>\r
'''\r
\r
for row in data:\r
html += '\x3Ctr>' + "".join([f"\x3Ctd>{v}\x3C/td>" for v in row]) + '\x3C/tr>'\r
\r
html += '\x3C/table>'\r
return html\r
```\r
\r
---\r
\r
## 核心命令\r
\r
### 1. 生成图表\r
```\r
命令:生成图表 [类型] [数据]\r
\r
示例:\r
- 生成图表 折线图 [1,2,3,4,5]\r
- 生成图表 柱状图 苹果:100,香蕉:80\r
```\r
\r
### 2. 生成K线\r
```\r
命令:生成K线 [股票代码]\r
\r
示例:\r
- 生成K线 600519\r
```\r
\r
### 3. 生成报告\r
```\r
命令:生成报告 [报告名称]\r
\r
示例:\r
- 生成报告 每日看板\r
- 生成报告 股票分析\r
```\r
\r
---\r
\r
## 应用场景\r
\r
### 1. 股票分析报告\r
```python\r
def stock_report(code):\r
"""生成股票报告"""\r
# 获取数据\r
data = get_stock_data(code)\r
\r
# 生成图表\r
chart1 = plot_candlestick(data['kline'], f'{code} K线')\r
chart2 = plot_bar(data['volume']['date'], data['volume']['vol'], '成交量')\r
\r
# 生成HTML报告\r
html = f'''\r
\x3Chtml>\r
\x3Chead>\x3Ctitle>{code} 分析报告\x3C/title>\x3C/head>\r
\x3Cbody>\r
\x3Ch1>{code} 分析报告\x3C/h1>\r
\x3Cimg src="{chart1}">\r
\x3Cimg src="{chart2}">\r
\x3C/body>\r
\x3C/html>\r
'''\r
\r
with open(f'{code}_report.html', 'w') as f:\r
f.write(html)\r
\r
return f'{code}_report.html'\r
```\r
\r
### 2. 策略回测报告\r
```python\r
def backtest_report(results):\r
"""生成回测报告"""\r
# 收益曲线\r
equity_chart = plot_line({\r
'x': results['dates'],\r
'y': results['equity']\r
}, '收益曲线', '日期', '资金')\r
\r
# 统计\r
stats = calculate_stats(results)\r
\r
html = f'''\r
\x3Chtml>\r
\x3Cbody>\r
\x3Ch1>策略回测报告\x3C/h1>\r
\x3Cimg src="{equity_chart}">\r
\x3Ch2>统计数据\x3C/h2>\r
\x3Cul>\r
\x3Cli>总收益率: {stats['total_return']:.2f}%\x3C/li>\r
\x3Cli>年化收益: {stats['annual_return']:.2f}%\x3C/li>\r
\x3Cli>夏普比率: {stats['sharpe']:.2f}\x3C/li>\r
\x3Cli>最大回撤: {stats['max_drawdown']:.2f}%\x3C/li>\r
\x3C/ul>\r
\x3C/body>\r
\x3C/html>\r
'''\r
\r
return html\r
```\r
\r
---\r
\r
## 图表类型选择\r
\r
| 场景 | 推荐图表 |\r
|------|---------|\r
| 趋势变化 | 折线图 |\r
| 对比分析 | 柱状图 |\r
| 占比分布 | 饼图/环形图 |\r
| 相关性 | 热力图/散点图 |\r
| K线走势 | 蜡烛图 |\r
| 分布情况 | 直方图/箱线图 |\r
| 地理数据 | 地图热力图 |\r
\r
---\r
\r
## 注意事项\r
\r
1. **数据量**:大数据集要采样\r
2. **中文显示**:配置中文字体\r
3. **交互性**:需要交互用Plotly\r
4. **导出格式**:PNG清晰/HTML交互\r
\r
\r
## Code Implementation\r
\r
Python实现: chart_generator.py\r
\r
`python\r
from chart_generator import ChartGenerator, quick_chart\r
\r
# 快速图表\r
chart = quick_chart(data, 'line', 'date', ['sales', 'profit'])\r
chart.save('chart.png')\r
\r
# 或使用完整API\r
gen = ChartGenerator()\r
gen.line_chart(data, 'date', 'sales', title='Sales')\r
gen.bar_chart(data, 'category', 'value')\r
gen.pie_chart(data, 'name', 'value')\r
gen.scatter_chart(data, 'x', 'y', size='size', color='category')\r
`\r
安全使用建议
This skill appears to be a charting toolkit and the code mostly matches that purpose, but there are several red flags to check before installing or using it:
- Verify completeness: run a quick static review to confirm functions referenced in examples (plot_gauge, plot_funnel, batch_charts, get_color_scheme, etc.) actually exist in the provided files. Missing functions indicate a broken or partial package.
- Dependency management: requirements.txt lists heavy optional libs (plotly, kaleido, folium). Because there is no install spec, you will need to install them yourself in a controlled environment; avoid giving the agent permission to pip-install packages automatically.
- External connectors: README/SKILL.md mention ai_workflow, DatabaseOps, FeishuSheets and map libraries (amap/bmap). Those are not included and would require credentials/API keys — do not provide secrets unless you confirm and trust the integration code and endpoints.
- Source provenance: the package metadata lists no homepage and the source is unknown. If you need this for production, prefer a package with a known upstream (GitHub/PyPI) and an official release page.
- Run in sandbox: test the skill in an isolated environment (no sensitive data, no access to production databases or cloud credentials) to ensure behavior matches expectations and no unexpected network calls occur.
If you want, I can (1) scan the files for the exact presence/absence of the example-referenced functions, (2) search the code for any network or file-exfiltration patterns, or (3) suggest minimal commands to safely test the package in a sandboxed environment.
功能分析
Type: OpenClaw Skill
Name: chart-toolkit
Version: 1.0.0
The skill bundle is a comprehensive data visualization toolkit providing wrappers for Matplotlib, Plotly, and Folium. The code in chart_generator.py and chart_enhanced.py implements standard charting functions (line, bar, pie, 3D, maps, etc.) and includes logic for handling Chinese fonts and exporting charts to PNG or HTML. While the README.md references external modules not included in the bundle (e.g., database_ops, feishu_sheets), there is no evidence of malicious intent, data exfiltration, or prompt injection; the instructions in SKILL.md are strictly aligned with the stated purpose of generating visual reports and dashboards.
能力评估
Purpose & Capability
The name, SKILL.md, README, and the Python files consistently focus on chart generation, dashboards, and exports: this aligns with the stated purpose. However, the README and SKILL.md mention integration with other tooling (ai_workflow, DatabaseOps, FeishuSheets, data_parser, excel_parser) that are not provided or declared, and the README claims a larger feature set (30+ chart types) than is clearly implemented in the provided code. That mismatch is a quality/packaging issue rather than direct malice, but it is an inconsistency.
Instruction Scope
The SKILL.md and README primarily show safe plotting instructions. But they also include example/import lines that pull in unrelated connectors (ai_workflow, DatabaseOps, FeishuSheets, etc.) and an OpenClaw/Claude Code usage snippet — these are not part of the skill and imply the agent might be instructed to access external data systems. Additionally, examples import functions such as plot_gauge, plot_funnel, batch_charts and others; some of those are referenced but not clearly present in the provided code (the code is truncated in places), indicating either missing code or mismatched examples. Instructions that encourage importing external connectors without declaring env vars or showing where those connectors come from are scope creep and worth flagging.
Install Mechanism
There is no install spec (instruction-only), which is lower risk, but the package includes code files and a requirements.txt listing matplotlib/pandas and optional plotly/kaleido/folium. Because no install step is declared, users/agents may need to install dependencies manually. This is an inconsistency (files present but no install instructions in the registry metadata) and could lead to runtime errors or the agent attempting to install packages ad hoc.
Credentials
The skill requests no environment variables or credentials — appropriate for a local charting toolkit. That said, optional map-related imports (amap, bmap) and README references to external connectors imply potential integration points that would normally require API keys/credentials; those credentials are not declared. In short: declared environment access is minimal (ok), but the documentation hints at integrations that would require secrets not requested by the skill.
Persistence & Privilege
The skill does not request elevated runtime privileges, does not set always:true, and has no install hooks declared. It is user-invocable and allows autonomous invocation (platform default), which is expected. Nothing in the manifest indicates it will modify other skills or system-wide settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install chart-toolkit - 安装完成后,直接呼叫该 Skill 的名称或使用
/chart-toolkit触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of chart-toolkit.
- Provides chart generation for line, bar, pie, candlestick, and heatmap visualizations.
- Supports dashboard creation with combined multiple charts and real-time data updates.
- Enables automatic report export in PDF, HTML, and PNG formats.
- Includes interactive HTML dashboards using Plotly, and customized data tables.
- Offers example commands and code snippets for common data visualization and reporting scenarios.
元数据
常见问题
chart-toolkit 是什么?
Create and export various charts (line, bar, pie, candlestick, heatmap), dashboards, and HTML reports with real-time data updates and automatic refreshing. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 109 次。
如何安装 chart-toolkit?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install chart-toolkit」即可一键安装,无需额外配置。
chart-toolkit 是免费的吗?
是的,chart-toolkit 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
chart-toolkit 支持哪些平台?
chart-toolkit 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 chart-toolkit?
由 XiLi-aXi(@qiuwenxi416488212-ship-it)开发并维护,当前版本 v1.0.0。
推荐 Skills