蓝色天空.知识 · 实践 · 创造
我的收藏
在线代码实验室

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

JAVASCRIPTECharts6.1.0 / Edge156.0.4314.58 / 自有同源数据与本地HTTP服务;实际程序化指针和动作echarts-sunburst.js
echarts-sunburst.js1730 行
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服务;实际程序化指针和动作 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程

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

入口文件:projects/echarts-lab/src/echarts-sunburst.js

预期结果与验证条件观察提示
  • 对应变体真实运行;其数据、图元、事件或状态独立记录

请结合实际环境逐项观察。

附件与关联工程包下载

下载课程关联工程包:ECharts

课程关联工程包(登记关联12章) · 含当前章节或实例 · mbskycom202611a498.zip
SITE SEARCH

搜索教程、工具与资讯

热门搜索

JavaScriptJSON格式化正则表达式AI 编程AI 翻译AI导航专题标签
Esc 关闭

欢迎登录蓝色天空网

使用会员账号,继续你的学习