ECharts 旭日图:树、样式优先级、下钻与焦点
保留全部树形与交互目标,明确历史highlightPolicy的现代迁移及兼容边界。
学完这一章,你能够
- 保留全部树形与交互目标,明确历史highlightPolicy的现代迁移及兼容边界。
- 保留全部树形与交互目标,明确历史highlightPolicy的现代迁移及兼容边界。
层级与数值的关系
sunburst用children表达父子层级,内圈为父,外圈为子。叶节点value提供数值,缺少父值时可由子值汇总;显式父值与子和不同需解释剩余或数据质量,不能假定永远相等。
本例基本树保留父值12、子和9的差异及另一父节点自动求和。它同时表达层级与部分整体关系,但不能把不同层的扇区面积直接相加当总量。
三级样式优先级
data.itemStyle优先于levels对应层样式,再优先于series.itemStyle。levels[0]用于虚拟根/下钻返回等状态,不应误当第一个实际根节点层。
实例分别设置系列灰色、首层蓝色及指定节点红色,检查真实图元fill。局部显式颜色可以覆盖层色,不因配置出现先后就推断优先级。
下钻和节点点击
nodeClick默认可下钻,点击节点后该节点成为当前视图根,可通过返回图形回上层;nodeClick:false关闭默认行为。link模式需要节点link及适当target,本例仅链接到本页说明,不请求外部站点。
使用稳定节点id及sunburstRootToNode可重现下钻和返回。事件动作结果要核对当前viewRoot与图形层级,不把标题改成节点名就假装已下钻。
历史焦点策略与现代状态
旧highlightPolicy列出descendant、ancestor、self、none;旧highlight/downplay样式及sunburstHighlight属于历史接口。本课保留说明,以现代emphasis.focus及emphasis/blur表达焦点和淡化,再分别检查后代、祖先、自身与不聚焦。
6.1.0仍有部分旧动作的弃用转发,不能据此声称所有旧样式对象或旧版本语义完全兼容。普通highlight/downplay与旧动作对照独立,迁移结果需根据实际节点状态判断。
原页更多实例链接作为独立来源关系保留;未取得/未核对的外部示例仍待处理,不能只因本章有基础树就自动计为全部覆盖。
现代focus的相关节点通常保留普通态,只有真正悬停的节点使用emphasis;不能声称所有亲属都变红,或旧highlight橙色会自动完全复现。
多层目录与按深度排序
扩展示例保留四层目录、等级配色、深度相关排序、层间半径间隔、切向/外部文字、阴影及边框。本站使用独立课程任务数据,叶项value为1,父节点按有效子值汇总。
排序函数在首层按汇总值降序,在其他层按原数据次序;回调函数说明option并非严格JSON。旧例中计算出来却没有传入option的评分累计,不会改变最终图形数值,不能凭一段循环就称为加权评分图。
配置与生命周期参考
| API/字段 | 输入与用途 | 返回/条件 |
| echarts.init(dom,theme,opts) | 有尺寸的DOM、主题和renderer等 | ECharts实例;主题先注册,渲染器先引入 |
| setOption(option,opts) | 普通或复合选项 | void;默认合并,notMerge/replaceMerge按目标设置 |
| getOption() | 读取合并状态 | 配置对象;含默认值,不宜随意整体写回 |
| resize(opts) | width/height等对象 | void;不是resize(宽,高)两个数 |
| on / off | 事件名、可选query及handler | 按事件接口注册/解绑,同函数引用 |
| dispatchAction(payload) | 动作type及目标字段 | 动作及事件不是鼠标回调一一映射 |
| showLoading / hideLoading | 加载状态及可选配置 | 网络成功失败取消都须对应处理 |
| dispose / isDisposed | 释放与状态 | 销毁后不能被旧异步结果更新 |
| getInstanceByDom | 已初始化容器 | 实例或undefined |
| convertToPixel / convertFromPixel | 坐标查询与数值 | 需匹配实际坐标系和系列 |
| title / tooltip / legend | 标题、细节、系列选择 | 名称及所属系列对应 |
| xAxis / yAxis / series | 轴与数据系列 | 类型、单位、索引均明确 |
本章字段及全部分支
| 字段 | 作用 | 条件 |
| data.children / value | 树/数值 | 显式父值与子和可能不同 |
| data.itemStyle > levels.itemStyle > series.itemStyle | 样式优先级 | 实际图元色核对 |
| levels[0] | 虚拟根/返回状态 | 不当第一实际层 |
| nodeClick | rootToNode / false / link | 链接需link/target,本例本页目标 |
| sunburstRootToNode | 稳定节点id下钻/返回 | 实际viewRoot改变 |
| emphasis.focus | descendant/ancestor/self/none等 | 相关节点保留普通态不等于都emphasis |
| 旧highlightPolicy及highlight/downplay样式 | 历史知识 | 现代emphasis/blur迁移,非完整兼容承诺 |
| sunburstHighlight | 旧弃用转发 | 6.1.0固定环境单独观察 |
| sort callback | 按深度选排序方式 | option可含函数,不是严格JSON |
| levels.r0 / r | 分层半径及间隔 | 本例0/40/105/115/140/145 |
| label.rotate/position/textShadow | 径向/切向/外部及阴影 | 不把未使用的评分累计当权重 |
本章独立核心源码与验证步骤
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 本章所有变体真实渲染,实际图元和状态与本章教学条件对应
- 不同初始化、轴/数据编码、状态分支或媒体布局分别核对
- 定时器、请求及容器观察器在销毁后释放,不以模拟文字代替实际运行
三级样式优先级:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
下钻及返回:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
关闭默认下钻:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
节点链接到本页说明:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
现代焦点:descendant:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
现代焦点:ancestor:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
现代焦点:self:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
现代焦点:none:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
旧动作弃用转发对照:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
按深度排序、分层半径和外部标签:独立实例
展开查看收起
import * as echarts from 'echarts';
import {mount} from './lab.js';
// 本章独立配置和实际运行共用;数值均为自有虚构数据。
const specification = {
"key": "echarts-sunburst",
"title": "ECharts 旭日图:树、样式优先级、下钻与焦点",
"cases": [
{
"id": "sun-basic",
"title": "父值与子和不等的树",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-styles",
"title": "三级样式优先级",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
],
"itemStyle": {
"color": "#ff0000"
}
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
},
"itemStyle": {
"color": "#aaaaaa"
},
"levels": [
{},
{
"itemStyle": {
"color": "#0000ff"
}
}
]
}
]
}
},
{
"id": "sun-drill",
"title": "下钻及返回",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "drill"
},
{
"id": "sun-disabled",
"title": "关闭默认下钻",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": false,
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-link",
"title": "节点链接到本页说明",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
],
"link": "#linked-note",
"target": "_self"
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "link",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
}
},
{
"id": "sun-focus-descendant",
"title": "现代焦点:descendant",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-ancestor",
"title": "现代焦点:ancestor",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "ancestor",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-self",
"title": "现代焦点:self",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "self",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-focus-none",
"title": "现代焦点:none",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "none",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "focus"
},
{
"id": "sun-legacy",
"title": "旧动作弃用转发对照",
"option": {
"animation": false,
"tooltip": {},
"series": [
{
"id": "curriculum-tree",
"type": "sunburst",
"sort": null,
"data": [
{
"id": "a",
"name": "课程A",
"value": 12,
"children": [
{
"id": "a1",
"name": "基础",
"value": 4,
"children": [
{
"id": "target",
"name": "目标",
"value": 2
},
{
"id": "other-leaf",
"name": "另一叶",
"value": 1
}
]
},
{
"id": "a2",
"name": "项目",
"value": 5
}
]
},
{
"id": "b",
"name": "课程B",
"children": [
{
"id": "b1",
"name": "阅读",
"value": 4
},
{
"id": "b2",
"name": "练习",
"value": 2
}
]
},
{
"id": "c",
"name": "回顾",
"value": 3
}
],
"radius": [
0,
"85%"
],
"nodeClick": "rootToNode",
"label": {
"rotate": "radial"
},
"emphasis": {
"focus": "descendant",
"itemStyle": {
"color": "#ff0000"
}
},
"blur": {
"itemStyle": {
"opacity": 0.15
}
}
}
]
},
"behavior": "legacy"
},
{
"id": "sun-catalogue",
"title": "按深度排序、分层半径和外部标签",
"option": {
"animation": false,
"backgroundColor": "#18283d",
"color": [
"#f59e0b",
"#ec4899",
"#8b5cf6",
"#2563eb"
],
"series": [
{
"id": "catalogue",
"type": "sunburst",
"center": [
"50%",
"48%"
],
"data": [
{
"name": "基础开发",
"children": [
{
"name": "HTML语义",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "HTML语义任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "HTML语义任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "HTML语义任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "HTML语义任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "CSS布局任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "CSS布局任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "CSS布局任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "CSS布局任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "CSS布局任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "JavaScript基础",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "JavaScript基础任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "JavaScript基础任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "JavaScript基础任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "JavaScript基础任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#f59e0b"
}
}
],
"itemStyle": {
"color": "#f59e0b"
}
},
{
"name": "应用开发",
"children": [
{
"name": "组件开发",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "组件开发任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "组件开发任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "组件开发任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "组件开发任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
},
{
"name": "2级",
"value": 0,
"label": {
"color": "#2563eb"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "数据管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "数据管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "数据管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "数据管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "数据管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "数据管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "图表表达",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "图表表达任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "图表表达任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "图表表达任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "图表表达任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "工程管理",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "工程管理任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "工程管理任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "工程管理任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "工程管理任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "工程管理任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "测试验证",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "测试验证任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "测试验证任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
},
{
"name": "测试验证任务2-2",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "测试验证任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
},
{
"name": "部署维护",
"children": [
{
"name": "5级",
"label": {
"color": "#f59e0b"
},
"children": [
{
"name": "部署维护任务1-1",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
},
{
"name": "部署维护任务1-2",
"value": 1,
"itemStyle": {
"color": "#f59e0b",
"opacity": 1
},
"label": {
"color": "#f59e0b"
}
}
]
},
{
"name": "4级",
"label": {
"color": "#ec4899"
},
"children": [
{
"name": "部署维护任务2-1",
"value": 1,
"itemStyle": {
"color": "#ec4899",
"opacity": 1
},
"label": {
"color": "#ec4899"
}
}
]
},
{
"name": "3级",
"label": {
"color": "#8b5cf6"
},
"children": [
{
"name": "部署维护任务3-1",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
},
{
"name": "部署维护任务3-2",
"value": 1,
"itemStyle": {
"color": "#8b5cf6",
"opacity": 1
},
"label": {
"color": "#8b5cf6"
}
}
]
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"itemStyle": {
"color": "#ec4899"
}
}
],
"label": {
"rotate": "radial",
"color": "#18283d"
},
"itemStyle": {
"borderColor": "#18283d",
"borderWidth": 2
},
"levels": [
{},
{
"r0": 0,
"r": 40,
"label": {
"rotate": 0
}
},
{
"r0": 40,
"r": 105
},
{
"r0": 115,
"r": 140,
"itemStyle": {
"shadowBlur": 2,
"shadowColor": "#8b5cf6",
"color": "transparent"
},
"label": {
"rotate": "tangential",
"fontSize": 10,
"color": "#f59e0b"
}
},
{
"r0": 140,
"r": 145,
"itemStyle": {
"shadowBlur": 30,
"shadowColor": "#f59e0b"
},
"label": {
"position": "outside",
"textShadowBlur": 5,
"textShadowColor": "#333"
}
}
],
"blur": {
"label": {
"opacity": 0.5
}
}
}
]
},
"behavior": "catalogue",
"height": 500
}
]
};
export default async function run(){await mount(echarts,specification);}
查看独立实例 ↗ 在独立页面查看源码、运行环境与工程包
- 对应变体真实运行;其数据、图元、事件或状态独立记录
本章附件与实例包
常见错误与边界检查
- 只看option或标题而未核对真实数据、图元、状态。
- 旧版本、外部数据及未运行环境被误写成已完成。
技术规范与官方资料
练习与参考解答
查看参考解答
保持图表类型、轴、维度、数据和交互对应;完整来源事实、真人键盘/触屏/读屏及其他版本仍需独立复核。