Data Visualization
创建美观的星级评分可视化,用于产品评分、服务评价和用户反馈分析
用三种语言从你的代码中调用此工具。
curl -X POST 'https://api.elysiatools.com/zh/api/tools/rating-star-chart' \
-H 'Content-Type: application/json' \
-d '{"ratingData":"JSON format:\n[{"label": "Product A", "rating": 4.5, "count": 120},\n{"label": "Product B", "rating": 3.8, "count": 85},\n{"label": "Product C", "rating": 4.2, "count": 200}]\n\nor text format:\nProduct A:4.5:120\nProduct B:3.8:85\nProduct C:4.2:200\n\nor just ratings:\n4.5\n3.8\n4.2","chartTitle":"输入图表标题...","layout":"list","starSize":"30","starColor":"#fbbf24","emptyStarColor":"#e5e7eb","animationDuration":"1000","backgroundColor":"#ffffff","showPercentage":true,"showCount":true,"showAverage":true,"showDecimal":true,"animated":true}'以 JSON 形式 POST 提交输入参数。文件类型参数需先单独上传。
POST https://api.elysiatools.com/zh/api/tools/rating-star-chart| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| ratingData | textarea | 是 | 评分数据(0-5)。支持带标签/评分/数量的JSON,简单的标签:评分:数量格式,或仅评分值 |
| chartTitle | text | 否 | 显示在图表上方的标题 |
| layout | select | 否 | — |
| starSize | number | 否 | 每颗星星的像素大小 |
| starColor | color | 否 | 填充星星的颜色 |
| emptyStarColor | color | 否 | 空星星的颜色 |
| animationDuration | number | 否 | 星星动画的毫秒时长 |
| backgroundColor | color | 否 | 图表容器的背景颜色 |
| showPercentage | checkbox | 否 | 显示评分分布和百分比 |
| showCount | checkbox | 否 | 显示每个项目的评论数量 |
| showAverage | checkbox | 否 | 显示总体评分摘要和统计 |
| showDecimal | checkbox | 否 | 显示小数评分(如4.5)而不是四舍五入 |
| animated | 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-rating-star-chart": {
"name": "rating-star-chart",
"description": "创建美观的星级评分可视化,用于产品评分、服务评价和用户反馈分析",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=rating-star-chart",
"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": "rating-star-chart",
"arguments": {
"ratingData": "JSON format:\n[{"label": "Product A", "rating": 4.5, "count": 120},\n{"label": "Product B", "rating": 3.8, "count": 85},\n{"label": "Product C", "rating": 4.2, "count": 200}]\n\nor text format:\nProduct A:4.5:120\nProduct B:3.8:85\nProduct C:4.2:200\n\nor just ratings:\n4.5\n3.8\n4.2",
"chartTitle": "输入图表标题...",
"layout": "list",
"starSize": "30",
"starColor": "#fbbf24",
"emptyStarColor": "#e5e7eb",
"animationDuration": "1000",
"backgroundColor": "#ffffff",
"showPercentage": true,
"showCount": true,
"showAverage": true,
"showDecimal": true,
"animated": true
}
}
}有问题或反馈?请联系 [email protected]