爱招飞帮助手册 爱招飞帮助手册
首页
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 功能用法
    • 专用模板
    • 开发流程
    • 函数程序
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 系统工具
    • 系统管理
    • 数据库工具
    • 专用模板
    • 外部功能
    • 开发流程
    • 函数代码
  • 开发手册
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 功能用法
    • 专用模板
    • 开发流程
    • 函数程序
  • 开发手册
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 功能用法
    • 专用模板
    • 开发流程
    • 函数程序
  • 开发手册
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
    • 报表设计
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
    • RestAPI
    • WebSocket
  • 学习手册

    • 安装配置
    • 快速上手
    • 程序架构
    • 界面介绍
    • 功能介绍
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
    • 预设资料
    • RestAPI说明
    • WebSocket说明
    • MQTT说明
    • Python说明
    • 自定程序
    • 运行卫士
    • 自动化作业
    • 函数程序
    • 控件使用
  • 开发手册
  • FastERP
  • FastWeb
  • Smart
  • PinToo
  • Flying
  • TARS
  • 通用功能

    • Report
    • Script
    • Echarts
    • Chart
    • DB Install
    • HiDesk
    • HiNAT
    • FastBPM
    • ReportBuilder
首页
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 功能用法
    • 专用模板
    • 开发流程
    • 函数程序
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 系统工具
    • 系统管理
    • 数据库工具
    • 专用模板
    • 外部功能
    • 开发流程
    • 函数代码
  • 开发手册
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 功能用法
    • 专用模板
    • 开发流程
    • 函数程序
  • 开发手册
  • 学习手册

    • 基本入门
    • 功能介绍
    • 控件说明
    • 功能用法
    • 专用模板
    • 开发流程
    • 函数程序
  • 开发手册
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
    • 报表设计
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
    • RestAPI
    • WebSocket
  • 学习手册

    • 安装配置
    • 快速上手
    • 程序架构
    • 界面介绍
    • 功能介绍
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
  • 学习手册

    • 安装配置
    • 快速上手
    • 界面介绍
    • 功能介绍
    • 预设资料
    • RestAPI说明
    • WebSocket说明
    • MQTT说明
    • Python说明
    • 自定程序
    • 运行卫士
    • 自动化作业
    • 函数程序
    • 控件使用
  • 开发手册
  • FastERP
  • FastWeb
  • Smart
  • PinToo
  • Flying
  • TARS
  • 通用功能

    • Report
    • Script
    • Echarts
    • Chart
    • DB Install
    • HiDesk
    • HiNAT
    • FastBPM
    • ReportBuilder
  • Report

  • Script

  • EChart

    • ECharts使用说明

      • ECharts特性
      • ECharts安装
      • ECharts配置语法
      • 在FastWeb中引入ECharts
      • ECharts基础概念概览
      • 个性化图表的样式
      • ECharts中的样式简介
      • 异步数据加载和更新
      • 使用dataset管理数据
      • 使用transform进行数据转换
      • 在图表中加入交互组件
      • 移动端自适应
      • 数据的视觉映射
      • ECharts中的事件和性为
      • 动态排序柱状图
      • 小例子自己实现拖拽
      • 小例子实现日历图
      • 旭日图
        • 18.1. 引入相关文件
        • 18.2. 最简单的旭日图
        • 18.3. 颜色等样式调整
        • 18.4. 按层配置样式
        • 18.5. 数据下钻
        • 18.6. 高亮相关扇形块
        • 18.7. 总结
      • 自定义系列
      • 富文本标签
    • ECharts属性说明

  • Chart

  • DB Install

  • HiDesk

  • HiNAT

  • ReportBuilder

目录

旭日图

# 18. 旭日图

旭日图(Sunburst) (opens new window)由多层的环形图组成,在数据结构上,内圈是外圈的父节点。因此,它既能像饼图一样表现局部和整体的占比,又能像矩形树图一样表现层级关系。

  • 图表来源:https://echarts.apache.org/examples/zh/editor.html?c=sunburst-monochrome (opens new window)

# 18.1. 引入相关文件

  旭日图是 Apache EChartsTM 4.0 新增的图表类型,从 CDN (opens new window) 引入完整版的 echarts.min.js (opens new window)

# 18.2. 最简单的旭日图

  创建旭日图需要在 series 配置项中声明类型为 'sunburst' 的系列,并且以树形结构声明其 data:

var option = {
    series: {
        type: 'sunburst',
        data: [{
            name: 'A',
            value: 10,
            children: [{
                value: 3,
                name: 'Aa'
            }, {
                value: 5,
                name: 'Ab'
            }]
        }, {
            name: 'B',
            children: [{
                name: 'Ba',
                value: 4
            }, {
                name: 'Bb',
                value: 2
            }]
        }, {
            name: 'C',
            value: 3
        }]
    }
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

  得到以下结果:

  • 图表来源:https://echarts.apache.org/examples/zh/editor.html?c=doc-example/sunburst-simple (opens new window)

  • FastWeb TUgEChart示例:

  如需在FastWeb中的TUgEChart中实现上述效果,则修改其Options属性,使用下列配置:

option = {
    series: {
        type: 'sunburst',
        data: [{
            name: 'A',
            value: 10,
            children: [{
                value: 3,
                name: 'Aa'
            }, {
                value: 5,
                name: 'Ab'
            }]
        }, {
            name: 'B',
            children: [{
                name: 'Ba',
                value: 4
            }, {
                name: 'Bb',
                value: 2
            }]
        }, {
            name: 'C',
            value: 3
        }]
    }
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  • FastWeb TUgURLFrame示例:

  如需在FastWeb中的TUgURLFrame中实现上述效果,则修改其HTML属性,使用下列内容:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="https://cdn.staticfile.org/echarts/5.1.2/echarts.min.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="main" style="width: 700px;height:400px;"></div>
    <script type="text/javascript">
        // 基于准备好的dom,初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var option;
        
        option = {
            series: {
                type: 'sunburst',
                data: [{
                    name: 'A',
                    value: 10,
                    children: [{
                        value: 3,
                        name: 'Aa'
                    }, {
                        value: 5,
                        name: 'Ab'
                    }]
                }, {
                    name: 'B',
                    children: [{
                        name: 'Ba',
                        value: 4
                    }, {
                        name: 'Bb',
                        value: 2
                    }]
                }, {
                    name: 'C',
                    value: 3
                }]
            }
        };        
        
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

# 18.3. 颜色等样式调整

  默认情况下会使用全局调色盘 color 分配最内层的颜色,其余层则与其父元素同色。在旭日图中,扇形块的颜色有以下三种设置方式:

  • 在 series.data.itemStyle 中设置每个扇形块的样式;
  • 在 series.levels.itemStyle 中设置每一层的样式;
  • 在 series.itemStyle 中设置整个旭日图的样式。

  上述三者的优先级是从高到低的,也就是说,配置了 series.data.itemStyle 的扇形块将会覆盖 series.levels.itemStyle 和 series.itemStyle 的设置。

  下面,我们将整体的颜色设为灰色 '#aaa',将最内层的颜色设为蓝色 'blue',将 Aa、B 这两块设为红色 'red'。

var option = {
    series: {
        type: 'sunburst',
        data: [{
            name: 'A',
            value: 10,
            children: [{
                value: 3,
                name: 'Aa',
                itemStyle: {
                    color: 'red'
                }
            }, {
                value: 5,
                name: 'Ab'
            }]
        }, {
            name: 'B',
            children: [{
                name: 'Ba',
                value: 4
            }, {
                name: 'Bb',
                value: 2
            }],
            itemStyle: {
                color: 'red'
            }
        }, {
            name: 'C',
            value: 3
        }],
        itemStyle: {
            color: '#aaa'
        },
        levels: [{
            // 留给数据下钻的节点属性
        }, {
            itemStyle: {
                color: 'blue'
            }
        }]
    }
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

  效果为:

  • 图表来源:https://echarts.apache.org/examples/zh/editor.html?c=doc-example/sunburst-color (opens new window)

  • FastWeb TUgEChart示例:

  如需在FastWeb中的TUgEChart中实现上述效果,则修改其Options属性,使用下列配置:

option = {
    series: {
        type: 'sunburst',
        data: [{
            name: 'A',
            value: 10,
            children: [{
                value: 3,
                name: 'Aa',
                itemStyle: {
                    color: 'red'
                }
            }, {
                value: 5,
                name: 'Ab'
            }]
        }, {
            name: 'B',
            children: [{
                name: 'Ba',
                value: 4
            }, {
                name: 'Bb',
                value: 2
            }],
            itemStyle: {
                color: 'red'
            }
        }, {
            name: 'C',
            value: 3
        }],
        itemStyle: {
            color: '#aaa'
        },
        levels: [{
            // 留给数据下钻的节点属性
        }, {
            itemStyle: {
                color: 'blue'
            }
        }]
    }
};
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
  • FastWeb TUgURLFrame示例:

  如需在FastWeb中的TUgURLFrame中实现上述效果,则修改其HTML属性,使用下列内容:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="https://cdn.staticfile.org/echarts/5.1.2/echarts.min.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="main" style="width: 700px;height:300px;"></div>
    <script type="text/javascript">
        // 基于准备好的dom,初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var option;
        
        option = {
            series: {
                type: 'sunburst',
                data: [{
                    name: 'A',
                    value: 10,
                    children: [{
                        value: 3,
                        name: 'Aa',
                        itemStyle: {
                            color: 'red'
                        }
                    }, {
                        value: 5,
                        name: 'Ab'
                    }]
                }, {
                    name: 'B',
                    children: [{
                        name: 'Ba',
                        value: 4
                    }, {
                        name: 'Bb',
                        value: 2
                    }],
                    itemStyle: {
                        color: 'red'
                    }
                }, {
                    name: 'C',
                    value: 3
                }],
                itemStyle: {
                    color: '#aaa'
                },
                levels: [{
                    // 留给数据下钻的节点属性
                }, {
                    itemStyle: {
                        color: 'blue'
                    }
                }]
            }
        };   
        
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

# 18.4. 按层配置样式

  旭日图是一种有层次的结构,为了方便同一层样式的配置,我们提供了 levels 配置项。它是一个数组,其中的第 0 项表示数据下钻后返回上级的图形,其后的每一项分别表示从圆心向外层的层级。

  例如,假设我们没有数据下钻功能,并且希望将最内层的扇形块的颜色设为红色,文字设为蓝色,可以这样设置:

series: {
    // ...
    levels: [
        {
            // 留给数据下钻点的空白配置
        },
        {
            // 最靠内测的第一层
            itemStyle: {
                color: 'red'
            },
            label: {
                color: 'blue'
            }
        },
        {
            // 第二层 ...
        }
    ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

  在实际使用的过程中,你会发现按层配置样式是一个很常用的功能,能够很大程度上提高配置的效率。

# 18.5. 数据下钻

  旭日图默认支持数据下钻,也就是说,当点击了扇形块之后,将以该扇形块的数据作为根节点,便于进一步了解该数据的细节。

  • 图表来源:https://echarts.apache.org/examples/zh/editor.html?c=sunburst-simple (opens new window)

  • FastWeb TUgURLFrame示例:

  如需在FastWeb中的TUgURLFrame中实现上述效果,则修改其HTML属性,使用下列内容:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="https://cdn.staticfile.org/echarts/5.1.2/echarts.min.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="main" style="width: 700px;height:500px;"></div>
    <script type="text/javascript">
        // 基于准备好的dom,初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var option;
        
        var data = [{
            name: 'Grandpa',
            children: [{
                name: 'Uncle Leo',
                value: 15,
                children: [{
                    name: 'Cousin Jack',
                    value: 2
                }, {
                    name: 'Cousin Mary',
                    value: 5,
                    children: [{
                        name: 'Jackson',
                        value: 2
                    }]
                }, {
                    name: 'Cousin Ben',
                    value: 4
                }]
            }, {
                name: 'Father',
                value: 10,
                children: [{
                    name: 'Me',
                    value: 5
                }, {
                    name: 'Brother Peter',
                    value: 1
                }]
            }]
        }, {
            name: 'Nancy',
            children: [{
                name: 'Uncle Nike',
                children: [{
                    name: 'Cousin Betty',
                    value: 1
                }, {
                    name: 'Cousin Jenny',
                    value: 2
                }]
            }]
        }];

        option = {
            series: {
                type: 'sunburst',
                // emphasis: {
                //     focus: 'ancestor'
                // },
                data: data,
                radius: [0, '90%'],
                label: {
                    rotate: 'radial'
                }
            }
        };
        
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

  当数据下钻后,中间会出现一个用于返回上一层的图形,该图形的样式可以通过 levels[0] 配置。

  如果不需要数据下钻功能,可以通过将 nodeClick 设置为 false 关闭;或者将其设为 'link',并将 data.link 设为点击扇形块对应打开的链接。

# 18.6. 高亮相关扇形块

  旭日图支持鼠标移动到某扇形块时,高亮相关数据块的操作,可以通过设置 highlightPolicy,包括以下几种高亮方式:

  • 'descendant'(默认值):高亮鼠标移动所在扇形块与其后代元素;
  • 'ancestor':高亮鼠标所在扇形块与其祖先元素;
  • 'self':仅高亮鼠标所在扇形块;
  • 'none':不会淡化(downplay)其他元素。

  上面提到的“高亮”,对于鼠标所在的扇形块,会使用 emphasis 样式;对于其他相关扇形块,则会使用 highlight 样式。通过这种方式,可以很方便地实现突出显示相关数据的需求。

  具体来说,对于配置项:

itemStyle: {
    color: 'yellow',
    borderWidth: 2,
    emphasis: {
        color: 'red'
    },
    highlight: {
        color: 'orange'
    },
    downplay: {
        color: '#ccc'
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13

highlightPolicy 为 'descendant' 或 'ancestor' 的效果分别为:

  • 图表来源:https://echarts.apache.org/examples/zh/editor.html?c=doc-example/sunburst-highlight-descendant (opens new window)
  • 图表来源:https://echarts.apache.org/examples/zh/editor.html?c=doc-example/sunburst-highlight-ancestor (opens new window)

# 18.7. 总结

  上面的教程主要讲述的是如何入门使用旭日图,感兴趣的用户可以在 配置项手册 查看更完整的文档。在灵活应用这些配置项之后,就能做出丰富多彩的旭日图了!

  • 图表来源:https://echarts.apache.org/examples/zh/editor.html?c=sunburst-book (opens new window)

  • FastWeb TUgURLFrame示例:

  如需在FastWeb中的TUgURLFrame中实现上述效果,则修改其HTML属性,使用下列内容:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="https://cdn.staticfile.org/echarts/5.1.2/echarts.min.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="main" style="width: 700px;height:600px;"></div>
    <script type="text/javascript">
        // 基于准备好的dom,初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var option;
        
        var colors = ['#FFAE57', '#FF7853', '#EA5151', '#CC3F57', '#9A2555'];
        var bgColor = '#2E2733';

        var itemStyle = {
            star5: {
                color: colors[0]
            },
            star4: {
                color: colors[1]
            },
            star3: {
                color: colors[2]
            },
            star2: {
                color: colors[3]
            }
        };

        var data = [{
            name: '虚构',
            itemStyle: {
                color: colors[1]
            },
            children: [{
                name: '小说',
                children: [{
                    name: '5☆',
                    children: [{
                        name: '疼'
                    }, {
                        name: '慈悲'
                    }, {
                        name: '楼下的房客'
                    }]
                }, {
                    name: '4☆',
                    children: [{
                        name: '虚无的十字架'
                    }, {
                        name: '无声告白'
                    }, {
                        name: '童年的终结'
                    }]
                }, {
                    name: '3☆',
                    children: [{
                        name: '疯癫老人日记'
                    }]
                }]
            }, {
                name: '其他',
                children: [{
                    name: '5☆',
                    children: [{
                        name: '纳博科夫短篇小说全集'
                    }]
                }, {
                    name: '4☆',
                    children: [{
                        name: '安魂曲'
                    }, {
                        name: '人生拼图版'
                    }]
                }, {
                    name: '3☆',
                    children: [{
                        name: '比起爱你,我更需要你'
                    }]
                }]
            }]
        }, {
            name: '非虚构',
            itemStyle: {
                color: colors[2]
            },
            children: [{
                name: '设计',
                children: [{
                    name: '5☆',
                    children: [{
                        name: '无界面交互'
                    }]
                }, {
                    name: '4☆',
                    children: [{
                        name: '数字绘图的光照与渲染技术'
                    }, {
                        name: '日本建筑解剖书'
                    }]
                }, {
                    name: '3☆',
                    children: [{
                        name: '奇幻世界艺术\n&RPG地图绘制讲座'
                    }]
                }]
            }, {
                name: '社科',
                children: [{
                    name: '5☆',
                    children: [{
                        name: '痛点'
                    }]
                }, {
                    name: '4☆',
                    children: [{
                        name: '卓有成效的管理者'
                    }, {
                        name: '进化'
                    }, {
                        name: '后物欲时代的来临'
                    }]
                }, {
                    name: '3☆',
                    children: [{
                        name: '疯癫与文明'
                    }]
                }]
            }, {
                name: '心理',
                children: [{
                    name: '5☆',
                    children: [{
                        name: '我们时代的神经症人格'
                    }]
                }, {
                    name: '4☆',
                    children: [{
                        name: '皮格马利翁效应'
                    }, {
                        name: '受伤的人'
                    }]
                }, {
                    name: '3☆'
                }, {
                    name: '2☆',
                    children: [{
                        name: '迷恋'
                    }]
                }]
            }, {
                name: '居家',
                children: [{
                    name: '4☆',
                    children: [{
                        name: '把房子住成家'
                    }, {
                        name: '只过必要生活'
                    }, {
                        name: '北欧简约风格'
                    }]
                }]
            }, {
                name: '绘本',
                children: [{
                    name: '5☆',
                    children: [{
                        name: '设计诗'
                    }]
                }, {
                    name: '4☆',
                    children: [{
                        name: '假如生活糊弄了你'
                    }, {
                        name: '博物学家的神秘动物图鉴'
                    }]
                }, {
                    name: '3☆',
                    children: [{
                        name: '方向'
                    }]
                }]
            }, {
                name: '哲学',
                children: [{
                    name: '4☆',
                    children: [{
                        name: '人生的智慧'
                    }]
                }]
            }, {
                name: '技术',
                children: [{
                    name: '5☆',
                    children: [{
                        name: '代码整洁之道'
                    }]
                }, {
                    name: '4☆',
                    children: [{
                        name: 'Three.js 开发指南'
                    }]
                }]
            }]
        }];

        for (var j = 0; j < data.length; ++j) {
            var level1 = data[j].children;
            for (var i = 0; i < level1.length; ++i) {
                var block = level1[i].children;
                var bookScore = [];
                var bookScoreId;
                for (var star = 0; star < block.length; ++star) {
                    var style = (function (name) {
                        switch (name) {
                        case '5☆':
                            bookScoreId = 0;
                            return itemStyle.star5;
                        case '4☆':
                            bookScoreId = 1;
                            return itemStyle.star4;
                        case '3☆':
                            bookScoreId = 2;
                            return itemStyle.star3;
                        case '2☆':
                            bookScoreId = 3;
                            return itemStyle.star2;
                        }
                    })(block[star].name);

                    block[star].label = {
                        color: style.color,
                        downplay: {
                            opacity: 0.5
                        }
                    };

                    if (block[star].children) {
                        style = {
                            opacity: 1,
                            color: style.color
                        };
                        block[star].children.forEach(function (book) {
                            book.value = 1;
                            book.itemStyle = style;

                            book.label = {
                                color: style.color
                            };

                            var value = 1;
                            if (bookScoreId === 0 || bookScoreId === 3) {
                                value = 5;
                            }

                            if (bookScore[bookScoreId]) {
                                bookScore[bookScoreId].value += value;
                            }
                            else {
                                bookScore[bookScoreId] = {
                                    color: colors[bookScoreId],
                                    value: value
                                };
                            }
                        });
                    }
                }

                level1[i].itemStyle = {
                    color: data[j].itemStyle.color
                };
            }
        }

        option = {
            backgroundColor: bgColor,
            color: colors,
            series: [{
                type: 'sunburst',
                center: ['50%', '48%'],
                data: data,
                sort: function (a, b) {
                    if (a.depth === 1) {
                        return b.getValue() - a.getValue();
                    }
                    else {
                        return a.dataIndex - b.dataIndex;
                    }
                },
                label: {
                    rotate: 'radial',
                    color: bgColor
                },
                itemStyle: {
                    borderColor: bgColor,
                    borderWidth: 2
                },
                levels: [{}, {
                    r0: 0,
                    r: 40,
                    label: {
                        rotate: 0
                    }
                }, {
                    r0: 40,
                    r: 105
                }, {
                    r0: 115,
                    r: 140,
                    itemStyle: {
                        shadowBlur: 2,
                        shadowColor: colors[2],
                        color: 'transparent'
                    },
                    label: {
                        rotate: 'tangential',
                        fontSize: 10,
                        color: colors[0]
                    }
                }, {
                    r0: 140,
                    r: 145,
                    itemStyle: {
                        shadowBlur: 80,
                        shadowColor: colors[0]
                    },
                    label: {
                        position: 'outside',
                        textShadowBlur: 5,
                        textShadowColor: '#333'
                    },
                    downplay: {
                        label: {
                            opacity: 0.5
                        }
                    }
                }]
            }]
        };
        
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
  • 数据来源:https://echarts.apache.org/examples/zh/editor.html?c=sunburst-drink (opens new window)

  • FastWeb TUgURLFrame示例:

  如需在FastWeb中的TUgURLFrame中实现上述效果,则修改其HTML属性,使用下列内容:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>ECharts</title>
    <!-- 引入 echarts.js -->
    <script src="https://cdn.staticfile.org/echarts/5.1.2/echarts.min.js"></script>
</head>
<body>
    <!-- 为ECharts准备一个具备大小(宽高)的Dom -->
    <div id="main" style="width: 700px;height:600px;"></div>
    <script type="text/javascript">
        // 基于准备好的dom,初始化echarts实例
        var myChart = echarts.init(document.getElementById('main'));
        var option;
        
        
        var app = {};
        
        var data = [{
            name: 'Flora',
            itemStyle: {
                color: '#da0d68'
            },
            children: [{
                name: 'Black Tea',
                value: 1,
                itemStyle: {
                    color: '#975e6d'
                }
            }, {
                name: 'Floral',
                itemStyle: {
                    color: '#e0719c'
                },
                children: [{
                    name: 'Chamomile',
                    value: 1,
                    itemStyle: {
                        color: '#f99e1c'
                    }
                }, {
                    name: 'Rose',
                    value: 1,
                    itemStyle: {
                        color: '#ef5a78'
                    }
                }, {
                    name: 'Jasmine',
                    value: 1,
                    itemStyle: {
                        color: '#f7f1bd'
                    }
                }]
            }]
        }, {
            name: 'Fruity',
            itemStyle: {
                color: '#da1d23'
            },
            children: [{
                name: 'Berry',
                itemStyle: {
                    color: '#dd4c51'
                },
                children: [{
                    name: 'Blackberry',
                    value: 1,
                    itemStyle: {
                        color: '#3e0317'
                    }
                }, {
                    name: 'Raspberry',
                    value: 1,
                    itemStyle: {
                        color: '#e62969'
                    }
                }, {
                    name: 'Blueberry',
                    value: 1,
                    itemStyle: {
                        color: '#6569b0'
                    }
                }, {
                    name: 'Strawberry',
                    value: 1,
                    itemStyle: {
                        color: '#ef2d36'
                    }
                }]
            }, {
                name: 'Dried Fruit',
                itemStyle: {
                    color: '#c94a44'
                },
                children: [{
                    name: 'Raisin',
                    value: 1,
                    itemStyle: {
                        color: '#b53b54'
                    }
                }, {
                    name: 'Prune',
                    value: 1,
                    itemStyle: {
                        color: '#a5446f'
                    }
                }]
            }, {
                name: 'Other Fruit',
                itemStyle: {
                    color: '#dd4c51'
                },
                children: [{
                    name: 'Coconut',
                    value: 1,
                    itemStyle: {
                        color: '#f2684b'
                    }
                }, {
                    name: 'Cherry',
                    value: 1,
                    itemStyle: {
                        color: '#e73451'
                    }
                }, {
                    name: 'Pomegranate',
                    value: 1,
                    itemStyle: {
                        color: '#e65656'
                    }
                }, {
                    name: 'Pineapple',
                    value: 1,
                    itemStyle: {
                        color: '#f89a1c'
                    }
                }, {
                    name: 'Grape',
                    value: 1,
                    itemStyle: {
                        color: '#aeb92c'
                    }
                }, {
                    name: 'Apple',
                    value: 1,
                    itemStyle: {
                        color: '#4eb849'
                    }
                }, {
                    name: 'Peach',
                    value: 1,
                    itemStyle: {
                        color: '#f68a5c'
                    }
                }, {
                    name: 'Pear',
                    value: 1,
                    itemStyle: {
                        color: '#baa635'
                    }
                }]
            }, {
                name: 'Citrus Fruit',
                itemStyle: {
                    color: '#f7a128'
                },
                children: [{
                    name: 'Grapefruit',
                    value: 1,
                    itemStyle: {
                        color: '#f26355'
                    }
                }, {
                    name: 'Orange',
                    value: 1,
                    itemStyle: {
                        color: '#e2631e'
                    }
                }, {
                    name: 'Lemon',
                    value: 1,
                    itemStyle: {
                        color: '#fde404'
                    }
                }, {
                    name: 'Lime',
                    value: 1,
                    itemStyle: {
                        color: '#7eb138'
                    }
                }]
            }]
        }, {
            name: 'Sour/\nFermented',
            itemStyle: {
                color: '#ebb40f'
            },
            children: [{
                name: 'Sour',
                itemStyle: {
                    color: '#e1c315'
                },
                children: [{
                    name: 'Sour Aromatics',
                    value: 1,
                    itemStyle: {
                        color: '#9ea718'
                    }
                }, {
                    name: 'Acetic Acid',
                    value: 1,
                    itemStyle: {
                        color: '#94a76f'
                    }
                }, {
                    name: 'Butyric Acid',
                    value: 1,
                    itemStyle: {
                        color: '#d0b24f'
                    }
                }, {
                    name: 'Isovaleric Acid',
                    value: 1,
                    itemStyle: {
                        color: '#8eb646'
                    }
                }, {
                    name: 'Citric Acid',
                    value: 1,
                    itemStyle: {
                        color: '#faef07'
                    }
                }, {
                    name: 'Malic Acid',
                    value: 1,
                    itemStyle: {
                        color: '#c1ba07'
                    }
                }]
            }, {
                name: 'Alcohol/\nFremented',
                itemStyle: {
                    color: '#b09733'
                },
                children: [{
                    name: 'Winey',
                    value: 1,
                    itemStyle: {
                        color: '#8f1c53'
                    }
                }, {
                    name: 'Whiskey',
                    value: 1,
                    itemStyle: {
                        color: '#b34039'
                    }
                }, {
                    name: 'Fremented',
                    value: 1,
                    itemStyle: {
                        color: '#ba9232'
                    }
                }, {
                    name: 'Overripe',
                    value: 1,
                    itemStyle: {
                        color: '#8b6439'
                    }
                }]
            }]
        }, {
            name: 'Green/\nVegetative',
            itemStyle: {
                color: '#187a2f'
            },
            children: [{
                name: 'Olive Oil',
                value: 1,
                itemStyle: {
                    color: '#a2b029'
                }
            }, {
                name: 'Raw',
                value: 1,
                itemStyle: {
                    color: '#718933'
                }
            }, {
                name: 'Green/\nVegetative',
                itemStyle: {
                    color: '#3aa255'
                },
                children: [{
                    name: 'Under-ripe',
                    value: 1,
                    itemStyle: {
                        color: '#a2bb2b'
                    }
                }, {
                    name: 'Peapod',
                    value: 1,
                    itemStyle: {
                        color: '#62aa3c'
                    }
                }, {
                    name: 'Fresh',
                    value: 1,
                    itemStyle: {
                        color: '#03a653'
                    }
                }, {
                    name: 'Dark Green',
                    value: 1,
                    itemStyle: {
                        color: '#038549'
                    }
                }, {
                    name: 'Vegetative',
                    value: 1,
                    itemStyle: {
                        color: '#28b44b'
                    }
                }, {
                    name: 'Hay-like',
                    value: 1,
                    itemStyle: {
                        color: '#a3a830'
                    }
                }, {
                    name: 'Herb-like',
                    value: 1,
                    itemStyle: {
                        color: '#7ac141'
                    }
                }]
            }, {
                name: 'Beany',
                value: 1,
                itemStyle: {
                    color: '#5e9a80'
                }
            }]
        }, {
            name: 'Other',
            itemStyle: {
                color: '#0aa3b5'
            },
            children: [{
                name: 'Papery/Musty',
                itemStyle: {
                    color: '#9db2b7'
                },
                children: [{
                    name: 'Stale',
                    value: 1,
                    itemStyle: {
                        color: '#8b8c90'
                    }
                }, {
                    name: 'Cardboard',
                    value: 1,
                    itemStyle: {
                        color: '#beb276'
                    }
                }, {
                    name: 'Papery',
                    value: 1,
                    itemStyle: {
                        color: '#fefef4'
                    }
                }, {
                    name: 'Woody',
                    value: 1,
                    itemStyle: {
                        color: '#744e03'
                    }
                }, {
                    name: 'Moldy/Damp',
                    value: 1,
                    itemStyle: {
                        color: '#a3a36f'
                    }
                }, {
                    name: 'Musty/Dusty',
                    value: 1,
                    itemStyle: {
                        color: '#c9b583'
                    }
                }, {
                    name: 'Musty/Earthy',
                    value: 1,
                    itemStyle: {
                        color: '#978847'
                    }
                }, {
                    name: 'Animalic',
                    value: 1,
                    itemStyle: {
                        color: '#9d977f'
                    }
                }, {
                    name: 'Meaty Brothy',
                    value: 1,
                    itemStyle: {
                        color: '#cc7b6a'
                    }
                }, {
                    name: 'Phenolic',
                    value: 1,
                    itemStyle: {
                        color: '#db646a'
                    }
                }]
            }, {
                name: 'Chemical',
                itemStyle: {
                    color: '#76c0cb'
                },
                children: [{
                    name: 'Bitter',
                    value: 1,
                    itemStyle: {
                        color: '#80a89d'
                    }
                }, {
                    name: 'Salty',
                    value: 1,
                    itemStyle: {
                        color: '#def2fd'
                    }
                }, {
                    name: 'Medicinal',
                    value: 1,
                    itemStyle: {
                        color: '#7a9bae'
                    }
                }, {
                    name: 'Petroleum',
                    value: 1,
                    itemStyle: {
                        color: '#039fb8'
                    }
                }, {
                    name: 'Skunky',
                    value: 1,
                    itemStyle: {
                        color: '#5e777b'
                    }
                }, {
                    name: 'Rubber',
                    value: 1,
                    itemStyle: {
                        color: '#120c0c'
                    }
                }]
            }]
        }, {
            name: 'Roasted',
            itemStyle: {
                color: '#c94930'
            },
            children: [{
                name: 'Pipe Tobacco',
                value: 1,
                itemStyle: {
                    color: '#caa465'
                }
            }, {
                name: 'Tobacco',
                value: 1,
                itemStyle: {
                    color: '#dfbd7e'
                }
            }, {
                name: 'Burnt',
                itemStyle: {
                    color: '#be8663'
                },
                children: [{
                    name: 'Acrid',
                    value: 1,
                    itemStyle: {
                        color: '#b9a449'
                    }
                }, {
                    name: 'Ashy',
                    value: 1,
                    itemStyle: {
                        color: '#899893'
                    }
                }, {
                    name: 'Smoky',
                    value: 1,
                    itemStyle: {
                        color: '#a1743b'
                    }
                }, {
                    name: 'Brown, Roast',
                    value: 1,
                    itemStyle: {
                        color: '#894810'
                    }
                }]
            }, {
                name: 'Cereal',
                itemStyle: {
                    color: '#ddaf61'
                },
                children: [{
                    name: 'Grain',
                    value: 1,
                    itemStyle: {
                        color: '#b7906f'
                    }
                }, {
                    name: 'Malt',
                    value: 1,
                    itemStyle: {
                        color: '#eb9d5f'
                    }
                }]
            }]
        }, {
            name: 'Spices',
            itemStyle: {
                color: '#ad213e'
            },
            children: [{
                name: 'Pungent',
                value: 1,
                itemStyle: {
                    color: '#794752'
                }
            }, {
                name: 'Pepper',
                value: 1,
                itemStyle: {
                    color: '#cc3d41'
                }
            }, {
                name: 'Brown Spice',
                itemStyle: {
                    color: '#b14d57'
                },
                children: [{
                    name: 'Anise',
                    value: 1,
                    itemStyle: {
                        color: '#c78936'
                    }
                }, {
                    name: 'Nutmeg',
                    value: 1,
                    itemStyle: {
                        color: '#8c292c'
                    }
                }, {
                    name: 'Cinnamon',
                    value: 1,
                    itemStyle: {
                        color: '#e5762e'
                    }
                }, {
                    name: 'Clove',
                    value: 1,
                    itemStyle: {
                        color: '#a16c5a'
                    }
                }]
            }]
        }, {
            name: 'Nutty/\nCocoa',
            itemStyle: {
                color: '#a87b64'
            },
            children: [{
                name: 'Nutty',
                itemStyle: {
                    color: '#c78869'
                },
                children: [ {
                    name: 'Peanuts',
                    value: 1,
                    itemStyle: {
                        color: '#d4ad12'
                    }
                }, {
                    name: 'Hazelnut',
                    value: 1,
                    itemStyle: {
                        color: '#9d5433'
                    }
                }, {
                    name: 'Almond',
                    value: 1,
                    itemStyle: {
                        color: '#c89f83'
                    }
                }]
            }, {
                name: 'Cocoa',
                itemStyle: {
                    color: '#bb764c'
                },
                children: [{
                    name: 'Chocolate',
                    value: 1,
                    itemStyle: {
                        color: '#692a19'
                    }
                }, {
                    name: 'Dark Chocolate',
                    value: 1,
                    itemStyle: {
                        color: '#470604'
                    }
                }]
            }]
        }, {
            name: 'Sweet',
            itemStyle: {
                color: '#e65832'
            },
            children: [{
                name: 'Brown Sugar',
                itemStyle: {
                    color: '#d45a59'
                },
                children: [{
                    name: 'Molasses',
                    value: 1,
                    itemStyle: {
                        color: '#310d0f'
                    }
                }, {
                    name: 'Maple Syrup',
                    value: 1,
                    itemStyle: {
                        color: '#ae341f'
                    }
                }, {
                    name: 'Caramelized',
                    value: 1,
                    itemStyle: {
                        color: '#d78823'
                    }
                }, {
                    name: 'Honey',
                    value: 1,
                    itemStyle: {
                        color: '#da5c1f'
                    }
                }]
            }, {
                name: 'Vanilla',
                value: 1,
                itemStyle: {
                    color: '#f89a80'
                }
            }, {
                name: 'Vanillin',
                value: 1,
                itemStyle: {
                    color: '#f37674'
                }
            }, {
                name: 'Overall Sweet',
                value: 1,
                itemStyle: {
                    color: '#e75b68'
                }
            }, {
                name: 'Sweet Aromatics',
                value: 1,
                itemStyle: {
                    color: '#d0545f'
                }
            }]
        }];

        option = {
            title: {
                text: 'WORLD COFFEE RESEARCH SENSORY LEXICON',
                subtext: 'Source: https://worldcoffeeresearch.org/work/sensory-lexicon/',
                textStyle: {
                    fontSize: 14,
                    align: 'center'
                },
                subtextStyle: {
                    align: 'center'
                },
                sublink: 'https://worldcoffeeresearch.org/work/sensory-lexicon/'
            },
            series: {
                type: 'sunburst',

                data: data,
                radius: [0, '95%'],
                sort: null,

                emphasis: {
                    focus: 'ancestor'
                },

                levels: [{}, {
                    r0: '15%',
                    r: '35%',
                    itemStyle: {
                        borderWidth: 2
                    },
                    label: {
                        rotate: 'tangential'
                    }
                }, {
                    r0: '35%',
                    r: '70%',
                    label: {
                        align: 'right'
                    }
                }, {
                    r0: '70%',
                    r: '72%',
                    label: {
                        position: 'outside',
                        padding: 3,
                        silent: false
                    },
                    itemStyle: {
                        borderWidth: 3
                    }
                }]
            }
        };
        
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
小例子实现日历图
自定义系列

← 小例子实现日历图 自定义系列→

Copyright © 2021-2025 爱招飞IsoFace | ALL Rights Reserved
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式