前言¶
在开发智能体时,让大模型直接输出图表文件或复杂的图表配置往往超出了当前模型的文本生成能力。开发者通常需要手动编写图表代码或寻找外部工具,增加了开发成本。DSH 插件生态提供了解决这一问题的方案。
插件介绍¶
xby-generate-echarts 是一个基于 Apache ECharts 的动态图表生成和数据分析工具。该插件由 xby-skill 维护,旨在通过 MCP 协议,让智能体能够直接生成各种类型的可视化图表。
核心功能¶
该插件提供以下主要功能:
- set_xby_apikey:在对话中设置 API 密钥,该配置会自动持久化,重启后依然有效。
- generate_echarts:通用的图表生成接口,使用 Apache ECharts 的配置项动态生成可视化图表。
- 图表类型支持:
- generate_line_chart:线图(趋势分析)
- generate_bar_chart:柱状图(数值对比)
- generate_pie_chart:饼图(比例分布)
- generate_radar_chart:雷达图(多维数据)
- generate_scatter_chart:散点图(变量关系)
- generate_sankey_chart:桑基图(数据流向)
- generate_funnel_chart:漏斗图(转化过程)
- generate_gauge_chart:仪表盘图(单指标状态)
- generate_treemap_chart:树图(层级数据)
- generate_sunburst_chart:旭日图(多层级结构)
- generate_heatmap_chart:热力图(密度/强度)
- generate_candlestick_chart:K线图(金融数据)
- generate_boxplot_chart:箱线图(统计摘要)
- generate_graph_chart:关系图(网络关系)
- generate_parallel_chart:平行坐标图(多维对比)
- generate_tree_chart:树图(层级结构)
安装与启用¶
在安装前,请确保已安装 DeepSeek Harness 并拥有网络连接。安装该插件需要指定 profile,默认推荐 web profile。
# 安装插件
dsh plugin --profile web add github:xby_skill/xby-generate-echarts
安装完成后,在聊天中调用相关功能即可使用。
典型用法¶
以下是该插件支持的典型调用场景:
-
趋势分析:生成线图,展示时间序列上的数据变化趋势。
> 示例:”Generate a line chart to show trends over time, such as, the ratio of Apple computer sales to Apple’s profits changed from 2000 to 2016.” -
数值对比:生成柱状图,用于不同类别之间的横向或纵向数值比较。
> 示例:”Generate a bar chart to show data for numerical comparisons among different categories, such as, comparing categorical data and for horizontal comparisons.” -
比例分布:生成饼图,用于展示部分与整体的比例关系。
> 示例:”Generate a pie chart to show the proportion of parts, such as, market share and budget allocation.” -
多维评估:生成雷达图,用于在多个维度上评估对象。
> 示例:”Generate a radar chart to display multidimensional data (four dimensions or more), such as, evaluate Huawei and Apple phones in terms of five dimensions: ease of use, functionality, camera, benchmark scores, and battery life.”
适用场景与注意¶
该插件适用于需要在智能体输出中包含可视化数据展示的开发者。
注意事项:
1. API 密钥:使用前需在小笨羊官网注册并获取 API 密钥。
2. 权限与合规:插件以当前 DSH 进程的权限运行,安装前请检查源码与许可证(MIT)。
3. 依赖说明:该插件基于 Apache ECharts 构建。
总结¶
xby-generate-echarts 填补了 LLM 文本生成与可视化呈现之间的空白,为智能体提供了生成专业图表的能力。如需查看更多细节或提交 Issue,可访问其 GitHub 仓库。