Toggle navigation
饼状图 三层表现百分比
By
b***n
2020-08-12 07:28:28
脚本
16
21
作品使用的第三方脚本
数据管理
上传数据
支持小于 5M 任意格式(csv, xlsx, json, xml, ...)的数据文件
上传后可以通过生成的文件链接异步获取托管的数据。
历史数据
0 条
无历史数据
代码修改记录
信息提示
保存作品
对当前截图不满意?你还可以
上传本地截图
重新截图
作品名称
作品描述
标签
geo
grid
legend
markLine
markPoint
bar
effectScatter
line
lines
map
timeline
title
toolbox
tooltip
visualMap
作品默认版本
最新
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
20:11:45
图表已生成
整理代码
刷新
代码
let num = 8 //当前值 let totalNum = 10 //数据总数 let colorOut = 'rgba(91,144,250,1)' // 最外层颜色 let colorCenter = 'rgba(98,150,255,0.2)' // 中间层颜色 let colorLeft = 'rgb(11,41,64)' // 剩余层颜色 let listOut = [] //最外层数据 let listCenter = [] //中间层数据 let innerRadius = ["0", "30%"] //内层半径 let centerRadius = ["40%", "68%"] //中间层半径 let outRadius = ["68%", "72%"] //最外层半径 // 空白间隔 let placeHolderStyle = { normal: { label: { show: false }, labelLine: { show: false }, color: colorLeft, borderColor: colorLeft, borderWidth: 0 } }; // 饼状图 数据 // 外层数据 listOut.push({ value: num, itemStyle: { normal: { color: colorOut } } }, { value: totalNum - num, itemStyle: placeHolderStyle }) // 中间层数据 listCenter.push({ value: num, itemStyle: { normal: { color: colorCenter } } }, { value: totalNum - num, itemStyle: placeHolderStyle }) option = { backgroundColor: '#04243E', tooltip: { show: false }, series: [{ // 最外层 name: '', type: 'pie', clockWise: false, labelLine: { normal: { show: false } }, center: ['50%', '50%'], radius: outRadius, hoverAnimation: false, data: listOut, }, { // 中间层 name: '', type: 'pie', clockWise: false, center: ['50%', '50%'], radius: centerRadius, hoverAnimation: false, itemStyle: { normal: { label: { show: false, }, labelLine: { show: false, } } }, data: listCenter, }, { // 最内层 name: '', type: "pie", hoverAnimation: false, radius: innerRadius, center: ["50%", "50%"], labelLine: { normal: { show: false } }, data: [{ // 总数 value: num, name: "", label: { normal: { show: true, position: "center", color: "#fff", formatter: params => { return params.value; }, fontSize: 28 } }, itemStyle: { normal: { color: new echarts.graphic.RadialGradient( 0.5, 0.5, 0.99, [{ offset: 0, color: "rgb(0, 0, 0, 0)" }, { offset: 1, color: "#d7eaf5" } ], false ) } } }] } ] };