蓝色天空网mbsky.com · 知识 · 实践 · 创造ECharts · 本地阅读预览
教程 / 前端开发 / ECharts

ECharts 旭日图:树、样式优先级、下钻与焦点

保留全部树形与交互目标,明确历史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]虚拟根/返回状态不当第一实际层
nodeClickrootToNode / false / link链接需link/target,本例本页目标
sunburstRootToNode稳定节点id下钻/返回实际viewRoot改变
emphasis.focusdescendant/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径向/切向/外部及阴影不把未使用的评分累计当权重

本章独立核心源码与验证步骤

javascript · 阅读源码
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);}
ECharts 旭日图:树、样式优先级、下钻与焦点:本章完整配置与行为

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 本章所有变体真实渲染,实际图元和状态与本章教学条件对应
  • 不同初始化、轴/数据编码、状态分支或媒体布局分别核对
  • 定时器、请求及容器观察器在销毁后释放,不以模拟文字代替实际运行

三级样式优先级:独立实例

javascript · 阅读源码
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);}
三级样式优先级:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

下钻及返回:独立实例

javascript · 阅读源码
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);}
下钻及返回:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

关闭默认下钻:独立实例

javascript · 阅读源码
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);}
关闭默认下钻:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

节点链接到本页说明:独立实例

javascript · 阅读源码
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);}
节点链接到本页说明:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

现代焦点:descendant:独立实例

javascript · 阅读源码
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:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

现代焦点:ancestor:独立实例

javascript · 阅读源码
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:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

现代焦点:self:独立实例

javascript · 阅读源码
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:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

现代焦点:none:独立实例

javascript · 阅读源码
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:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

旧动作弃用转发对照:独立实例

javascript · 阅读源码
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);}
旧动作弃用转发对照:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

按深度排序、分层半径和外部标签:独立实例

javascript · 阅读源码
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);}
按深度排序、分层半径和外部标签:独立实例

所需环境:ECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作

当前源码 SHA256:5d0aa6e31f6ba60cd4e0bc3b529411984e4d180f93c3e72fd7fcd26794a603cb

预期结果 · 待实际运行核验
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

常见错误与边界

  • 只看option或标题而未核对真实数据、图元、状态。
  • 旧版本、外部数据及未运行环境被误写成已完成。

练习与解答

改变一个维度、布局条件或状态,预判结果,再分别观察图形、文字和事件记录。

展开参考解答

保持图表类型、轴、维度、数据和交互对应;完整来源事实、真人键盘/触屏/读屏及其他版本仍需独立复核。

规范与官方依据