Data Visualization
创建瀑布图来可视化累积变化,支持正负值区分和汇总显示
用三种语言从你的代码中调用此工具。
curl -X POST 'https://api.elysiatools.com/zh/api/tools/waterfall-chart-generator' \
-H 'Content-Type: application/json' \
-d '{"chartTitle":"输入图表标题...","dataItems":"JSON format example:\n[{"label": "Starting Value", "value": 1000, "isSubtotal": true},\n{"label": "Revenue", "value": 500},\n{"label": "Costs", "value": -200},\n{"label": "Expenses", "value": -150},\n{"label": "Net Profit", "value": 150, "isSubtotal": true}]","xAxisLabel":"Categories","yAxisLabel":"Values","positiveColor":"#2196F3","negativeColor":"#F44336","totalColor":"#4CAF50","connectingLineColor":"#666666","barWidth":"60","showValues":true,"showTotal":true,"showConnectingLines":true,"valueFormat":"integer","fontSize":"12","titleSize":"18","fontFamily":"Arial","chartWidth":"800","chartHeight":"500","backgroundColor":"#ffffff","gridColor":"#e0e0e0","animationEnabled":true,"animationDuration":"1000"}'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/waterfall-chart-generator| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| chartTitle | text | 否 | 显示在瀑布图上方的标题 |
| dataItems | textarea | 是 | JSON数组格式的数据项,包含标签、数值和可选的小计标记 |
| xAxisLabel | text | 否 | X轴的标签 |
| yAxisLabel | text | 否 | Y轴的标签 |
| positiveColor | color | 否 | 正值柱状图的颜色 |
| negativeColor | color | 否 | 负值柱状图的颜色 |
| totalColor | color | 否 | 小计和总计柱状图的颜色 |
| connectingLineColor | color | 否 | 柱状图间连接线的颜色 |
| barWidth | number | 否 | 每个柱状图的像素宽度 |
| showValues | checkbox | 否 | 在柱状图顶部显示数值 |
| showTotal | checkbox | 否 | 自动添加最终总计柱状图 |
| showConnectingLines | checkbox | 否 | 显示柱状图间的连接线 |
| valueFormat | select | 否 | — |
| fontSize | number | 否 | 标签和数值的字体大小 |
| titleSize | number | 否 | 图表标题的字体大小 |
| fontFamily | text | 否 | 文本元素的字体族 |
| chartWidth | number | 否 | 图表的像素宽度 |
| chartHeight | number | 否 | 图表的像素高度 |
| backgroundColor | color | 否 | 图表的背景颜色 |
| gridColor | color | 否 | 网格线的颜色 |
| animationEnabled | checkbox | 否 | 加载时动画显示图表 |
| animationDuration | number | 否 | 动画持续时间(毫秒) |
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-waterfall-chart-generator": {
"name": "waterfall-chart-generator",
"description": "创建瀑布图来可视化累积变化,支持正负值区分和汇总显示",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=waterfall-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": "waterfall-chart-generator",
"arguments": {
"chartTitle": "输入图表标题...",
"dataItems": "JSON format example:\n[{"label": "Starting Value", "value": 1000, "isSubtotal": true},\n{"label": "Revenue", "value": 500},\n{"label": "Costs", "value": -200},\n{"label": "Expenses", "value": -150},\n{"label": "Net Profit", "value": 150, "isSubtotal": true}]",
"xAxisLabel": "Categories",
"yAxisLabel": "Values",
"positiveColor": "#2196F3",
"negativeColor": "#F44336",
"totalColor": "#4CAF50",
"connectingLineColor": "#666666",
"barWidth": "60",
"showValues": true,
"showTotal": true,
"showConnectingLines": true,
"valueFormat": "integer",
"fontSize": "12",
"titleSize": "18",
"fontFamily": "Arial",
"chartWidth": "800",
"chartHeight": "500",
"backgroundColor": "#ffffff",
"gridColor": "#e0e0e0",
"animationEnabled": true,
"animationDuration": "1000"
}
}
}有问题或反馈?请联系 [email protected]