Data analysis dashboard development skill. Use when users need to develop data dashboards, create/edit dashboard projects, build data visualization boards, or perform data cleaning for dashboards. Includes dashboard project creation (with sources parameter for auto-marking data sources), card planning, data cleaning (data_cleaning.py), card management tools (create_dashboard_cards, update_dashboard_cards, delete_dashboard_cards, query_dashboard_cards), map download tool (download_dashboard_maps), dashboard development, validation, and data source marking (magic.project.js sources array).
Provides complete data analysis dashboard (仪表板) development capabilities, including dashboard project creation, card planning, data cleaning, dashboard development, validation delivery, and full development workflow. Data cleaning is an important part of dashboard development. Data source marking uses magic.project.js sources array.
This document provides quick guidance and core tool descriptions. For details, refer to the following reference documents:
All tool calls via from sdk.tool import tool in this skill must be executed by passing code to run_skills_snippet's python_code parameter.
Important: Before executing the following steps, it's recommended to read the corresponding reference documents to understand detailed specifications:
reference/dashboard-workflow.md for complete workflowreference/project-setup.md for project structure, data sources, card planningreference/dashboard-data-cleaning.md for data cleaning specificationsreference/dashboard-development.md for card DSL, appearance, ECharts v6, card management toolsfrom sdk.tool import tool
result = tool.call('create_dashboard_project', {
"name": "销售数据分析看板",
"sources": [{"type": "file", "name": "sales.csv", "url": "../sales.csv"}]
})
if result.ok:
# 后续在该项目目录内进行卡片规划、数据清洗、看板开发
# sources 参数会自动写入 magic.project.js 的 sources 数组
pass
from sdk.tool import tool
result = tool.call('validate_dashboard', {
"project_path": "销售数据分析看板"
})
if result.ok:
# 无错误和警告方可交付
pass
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
name | 是 | string | 项目名称,看板将创建在工作区下此目录 |
sources | 否 | List[Dict[str, str]] | 原始数据源配置列表,将自动写入 magic.project.js 的 sources 数组。每项需含 type、name、url,示例:[{"type": "file", "name": "sales.csv", "url": "../sales.csv"}] |
返回 (result):成功时 result.ok 为 true,result.content 含创建路径等信息;失败时 result.ok 为 false,result.error 含错误信息(如目录已存在)。
数据源标记:创建项目时通过 sources 参数传入,会自动写入 magic.project.js 的 sources 数组;编辑现有项目时需手动更新 magic.project.js 中的 sources 数组。
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
project_path | 是 | string | 看板项目目录路径,相对于工作区根目录 |
返回 (result):成功时 result.ok 为 true,无错误和警告;失败时 result.ok 为 false,result.error 含校验失败原因。交付前必须校验通过,否则页面无法正常访问。
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
target_project | 是 | string | 要更新的看板项目目录名称 |
update_dashboard_js | 否 | boolean | 是否更新 dashboard.js,默认 false |
update_index_css | 否 | boolean | 是否更新 index.css,默认 false |
update_index_html | 否 | boolean | 是否更新 index.html,默认 false |
update_config_js | 否 | boolean | 是否更新 config.js,默认 false |
返回 (result):成功时 result.ok 为 true;失败时 result.error 含错误信息。
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
target_project | 是 | string | 要恢复备份的看板项目目录名称 |
restore_dashboard_js | 否 | boolean | 是否恢复 dashboard.js 备份 |
restore_index_css | 否 | boolean | 是否恢复 index.css 备份 |
restore_index_html | 否 | boolean | 是否恢复 index.html 备份 |
restore_config_js | 否 | boolean | 是否恢复 config.js 备份 |
返回 (result):成功时 result.ok 为 true;失败时 result.error 含错误信息。
Manual download Dashboard map GeoJSON tool. Usually no need to download manually, as maps are auto-downloaded by create_dashboard_cards, update_dashboard_cards, and validate_dashboard.
When to use: Before creating map cards, or when validate_dashboard didn't download needed maps.
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
project_path | 是 | string | 看板项目路径,相对于工作区根目录 |
area_names | 是 | List[str] | 要下载的地区名称列表(1-10个),支持:中国、provinces(如广东省、北京市)、major_city(如深圳市、广州市)。需使用精确名称 |
返回 (result):成功时 result.ok 为 true,result.extra_info 包含下载统计信息;失败时 result.ok 为 false,result.error 含错误信息。
Must use card management tools to operate data.js, strictly prohibited to edit directly. See reference/dashboard-development.md for details.
| 工具 | 说明 |
|---|---|
| create_dashboard_cards | 批量创建卡片,支持 auto_layout 参数自动生成铺满布局(可省略 layout) |
| update_dashboard_cards | 批量更新卡片,支持单字段编辑 |
| delete_dashboard_cards | 批量删除卡片,自动压缩布局 |
| query_dashboard_cards | 查询卡片信息,支持查询所有/指定卡片,支持字段过滤 |
auto_layout parameter (default false): When true, omit layout per card; the tool auto-generates gap-free layout by type order to avoid repeated validate failures. Recommend auto_layout=true when creating new dashboards.
| 参数 | 必填 | 类型 | 说明 |
|---|---|---|---|
project_path | 是 | string | 看板项目路径 |
cards | 是 | List | 卡片列表,每项含 id、type、source、getCardData;auto_layout=true 时可省略 layout |
auto_layout | 否 | boolean | 是否自动计算布局,默认 false;为 true 时省略 layout 由工具铺满 |
# 创建项目后检查 result.ok
# 识别数据源后传入 sources 参数,会自动写入 magic.project.js
result = tool.call('create_dashboard_project', {
"name": "销售数据分析看板",
"sources": [{"type": "file", "name": "sales.csv", "url": "../sales.csv"}]
})
if result.ok:
# 在 result.content 中可获取项目路径等信息
# sources 已自动写入 magic.project.js
pass