Data Visualization
从数据生成可自定义的环形图(甜甜圈图),具有中央空间,非常适合显示比例数据
用三种语言从你的代码中调用此工具。
curl -X POST 'https://api.elysiatools.com/zh/api/tools/donut-chart-generator' \
-H 'Content-Type: application/json' \
-d '{"chartData":"JSON format:\n[{"label": "Product A", "value": 35},\n{"label": "Product B", "value": 25},\n{"label": "Product C", "value": 20},\n{"label": "Product D", "value": 20}]\n\nor text format:\nProduct A:35\nProduct B:25\nProduct C:20\nProduct D:20","chartTitle":"输入图表标题...","colorScheme":"default","centerText":"Total","chartSize":"400","innerRadius":0,"outerRadius":0,"startAngle":"0","backgroundColor":"#ffffff","showPercentage":true,"showLegend":true,"showLabels":true,"showTotalInCenter":false,"explodeSlices":false}'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/donut-chart-generator| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| chartData | textarea | 是 | 环形图数据。支持JSON数组或简单的标签:值文本格式 |
| chartTitle | text | 否 | 显示在图表上方的标题 |
| colorScheme | select | 否 | — |
| centerText | text | 否 | 在环形图中心显示的文本(显示总计) |
| chartSize | number | 否 | 方形图表的像素尺寸 |
| innerRadius | number | 否 | 环形图的内半径像素值(留空自动) |
| outerRadius | number | 否 | 环形图的外半径像素值(留空自动) |
| startAngle | number | 否 | 起始角度(0=顶部,90=右侧) |
| backgroundColor | color | 否 | 图表容器的背景颜色 |
| showPercentage | checkbox | 否 | 在图表扇区上显示百分比 |
| showLegend | checkbox | 否 | 在图表下方显示图例 |
| showLabels | checkbox | 否 | 直接在环形图扇区上显示标签或百分比 |
| showTotalInCenter | checkbox | 否 | 在环形图中心显示总计值 |
| explodeSlices | checkbox | 否 | 将扇区彼此分离以强调 |
HTML 结果
{
"result": "<div>Processed HTML content</div>",
"error": "Error message (optional)",
"message": "Notification message (optional)",
"metadata": {
"key": "value"
}
}将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。
将以下内容加入你的 MCP 客户端配置:
{
"mcpServers": {
"elysiatools-donut-chart-generator": {
"name": "donut-chart-generator",
"description": "从数据生成可自定义的环形图(甜甜圈图),具有中央空间,非常适合显示比例数据",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=donut-chart-generator",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}连接到 SSE 端点后,列出已开放的工具:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}通过工具 id 调用,参数由其参数表构建:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "donut-chart-generator",
"arguments": {
"chartData": "JSON format:\n[{"label": "Product A", "value": 35},\n{"label": "Product B", "value": 25},\n{"label": "Product C", "value": 20},\n{"label": "Product D", "value": 20}]\n\nor text format:\nProduct A:35\nProduct B:25\nProduct C:20\nProduct D:20",
"chartTitle": "输入图表标题...",
"colorScheme": "default",
"centerText": "Total",
"chartSize": "400",
"innerRadius": 0,
"outerRadius": 0,
"startAngle": "0",
"backgroundColor": "#ffffff",
"showPercentage": true,
"showLegend": true,
"showLabels": true,
"showTotalInCenter": false,
"explodeSlices": false
}
}
}有问题或反馈?请联系 [email protected]