Elysia Tools Docs
ZH
语言
ZHESPTRUFRDEEN
返回主站
浏览工具

Data Visualization

对比条形图生成器

生成背对背条形图,用于正负值对比展示,非常适合数据集对比分析

html· HTML 结果打开工具

快速开始

用三种语言从你的代码中调用此工具。

cURL
curl -X POST 'https://api.elysiatools.com/zh/api/tools/comparison-bar-chart' \
  -H 'Content-Type: application/json' \
  -d '{"chartData":"JSON format:\n[{"label": "Product A", "leftValue": 65, "rightValue": 85},\n{"label": "Product B", "leftValue": 45, "rightValue": 75},\n{"label": "Product C", "leftValue": 80, "rightValue": 60}]\n\nor text format:\nProduct A|65|85\nProduct B|45|75\nProduct C|80|60","chartTitle":"输入图表标题...","colorScheme":"default","barColor":"#3b82f6","leftLabel":"Left Values","rightLabel":"Right Values","chartHeight":"500","barWidth":"30","maxValue":0,"minValue":"0","animationDuration":"1000","backgroundColor":"#ffffff","gridColor":"#e0e0e0","showGrid":true,"showValues":true,"showLegend":true}'

© 2026 Elysia Tools. 开发者文档。

返回主站浏览工具

API 参考

以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。

请求端点

HTTP
POST https://api.elysiatools.com/zh/api/tools/comparison-bar-chart

请求参数

参数名类型必填说明
chartDatatextarea是对比图数据。支持JSON数组或简单的标签|左值|右值文本格式
chartTitletext否显示在图表上方的标题
colorSchemeselect否—
barColorcolor否左侧条形的颜色(右侧条形颜色来自配色方案)
leftLabeltext否图表左侧的标签
rightLabeltext否图表右侧的标签
chartHeightnumber否图表的像素高度
barWidthnumber否条形的最大像素宽度
maxValuenumber否图表缩放的最大值(留空自动)
minValuenumber否图表缩放的最小值
animationDurationnumber否条形动画的毫秒时长
backgroundColorcolor否图表容器的背景颜色
gridColorcolor否网格线的颜色
showGridcheckbox否显示网格线以便更好阅读
showValuescheckbox否在条形上显示数值
showLegendcheckbox否在图表下方显示图例

响应格式

HTML 结果

JSON
{
  "result": "<div>Processed HTML content</div>",
  "error": "Error message (optional)",
  "message": "Notification message (optional)",
  "metadata": {
    "key": "value"
  }
}

MCP 集成

将此工具加入你的 Model Context Protocol 服务,让 AI 智能体可以列出并调用它。

服务配置

将以下内容加入你的 MCP 客户端配置:

mcp.json
{
  "mcpServers": {
    "elysiatools-comparison-bar-chart": {
      "name": "comparison-bar-chart",
      "description": "生成背对背条形图,用于正负值对比展示,非常适合数据集对比分析",
      "baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=comparison-bar-chart",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

列出可用工具

连接到 SSE 端点后,列出已开放的工具:

tools/list
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

调用此工具

通过工具 id 调用,参数由其参数表构建:

tools/call
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "comparison-bar-chart",
    "arguments": {
  "chartData": "JSON format:\n[{&quot;label&quot;: &quot;Product A&quot;, &quot;leftValue&quot;: 65, &quot;rightValue&quot;: 85},\n{&quot;label&quot;: &quot;Product B&quot;, &quot;leftValue&quot;: 45, &quot;rightValue&quot;: 75},\n{&quot;label&quot;: &quot;Product C&quot;, &quot;leftValue&quot;: 80, &quot;rightValue&quot;: 60}]\n\nor text format:\nProduct A|65|85\nProduct B|45|75\nProduct C|80|60",
  "chartTitle": "输入图表标题...",
  "colorScheme": "default",
  "barColor": "#3b82f6",
  "leftLabel": "Left Values",
  "rightLabel": "Right Values",
  "chartHeight": "500",
  "barWidth": "30",
  "maxValue": 0,
  "minValue": "0",
  "animationDuration": "1000",
  "backgroundColor": "#ffffff",
  "gridColor": "#e0e0e0",
  "showGrid": true,
  "showValues": true,
  "showLegend": true
}
  }
}
可用逗号分隔的 toolId 在一个会话中串联多个工具,例如 /mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp(最多 20 个)。

有问题或反馈?请联系 [email protected]

浏览工具
打开工具