Data Visualization
创建阶梯式数据可视化图表,完美展示离散数据随时间的变化
用三种语言从你的代码中调用此工具。
curl -X POST 'https://api.elysiatools.com/zh/api/tools/step-chart-generator' \
-H 'Content-Type: application/json' \
-d '{"chartTitle":"输入图表标题...","dataPoints":"JSON format example:\n[{"x": "Jan", "y": 100, "label": "January"},\n{"x": "Feb", "y": 150, "label": "February"},\n{"x": "Mar", "y": 120, "label": "March"},\n{"x": "Apr", "y": 180, "label": "April"}]","xAxisLabel":"X Axis","yAxisLabel":"Y Axis","stepStyle":"step-before","lineColor":"#3b82f6","lineWidth":"2","pointColor":"#3b82f6","pointSize":"4","showDataPoints":true,"showLabels":false,"showGrid":true,"fillArea":false,"areaColor":"#3b82f6","gridColor":"#e0e0e0","backgroundColor":"#ffffff","chartWidth":"800","chartHeight":"500","dataLabelFormat":"number","fontSize":"12","titleSize":"18","fontFamily":"Arial","animationEnabled":true,"animationDuration":"1000"}'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/step-chart-generator| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| chartTitle | text | 否 | 显示在步进图上方的标题 |
| dataPoints | textarea | 是 | JSON数组格式的数据点,包含x、y和可选标签属性 |
| xAxisLabel | text | 否 | X轴的标签 |
| yAxisLabel | text | 否 | Y轴的标签 |
| stepStyle | select | 是 | — |
| lineColor | color | 否 | 步进线的颜色 |
| lineWidth | number | 否 | 步进线的像素宽度 |
| pointColor | color | 否 | 数据点的颜色 |
| pointSize | number | 否 | 数据点的像素大小 |
| showDataPoints | checkbox | 否 | 在步进线上显示数据点 |
| showLabels | checkbox | 否 | 在数据点上显示数值标签 |
| showGrid | checkbox | 否 | 显示背景网格线 |
| fillArea | checkbox | 否 | 用颜色填充步进线下方的区域 |
| areaColor | color | 否 | 区域填充的颜色(如果启用) |
| gridColor | color | 否 | 网格线的颜色 |
| backgroundColor | color | 否 | 图表的背景颜色 |
| chartWidth | number | 否 | 图表的像素宽度 |
| chartHeight | number | 否 | 图表的像素高度 |
| dataLabelFormat | select | 否 | — |
| fontSize | number | 否 | 标签和文本的字体大小 |
| titleSize | number | 否 | 图表标题的字体大小 |
| fontFamily | text | 否 | 文本元素的字体族 |
| 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-step-chart-generator": {
"name": "step-chart-generator",
"description": "创建阶梯式数据可视化图表,完美展示离散数据随时间的变化",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=step-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": "step-chart-generator",
"arguments": {
"chartTitle": "输入图表标题...",
"dataPoints": "JSON format example:\n[{"x": "Jan", "y": 100, "label": "January"},\n{"x": "Feb", "y": 150, "label": "February"},\n{"x": "Mar", "y": 120, "label": "March"},\n{"x": "Apr", "y": 180, "label": "April"}]",
"xAxisLabel": "X Axis",
"yAxisLabel": "Y Axis",
"stepStyle": "step-before",
"lineColor": "#3b82f6",
"lineWidth": "2",
"pointColor": "#3b82f6",
"pointSize": "4",
"showDataPoints": true,
"showLabels": false,
"showGrid": true,
"fillArea": false,
"areaColor": "#3b82f6",
"gridColor": "#e0e0e0",
"backgroundColor": "#ffffff",
"chartWidth": "800",
"chartHeight": "500",
"dataLabelFormat": "number",
"fontSize": "12",
"titleSize": "18",
"fontFamily": "Arial",
"animationEnabled": true,
"animationDuration": "1000"
}
}
}有问题或反馈?请联系 [email protected]