Toggle navigation
中心渐变饼状图
By
小***琪
2020-02-14 12:45:22
脚本
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 bgColor = '#0A2E6A'; let circleColor = '#0075ff'; // 三个圆环的颜色 let gradientColor = ['#000204', '#0A2E6A']; // 中心圆渐变色 let color = ['#2EB2FA', '#43CC31', '#FFC145', '#FFA8A8']; // 数据图表颜色数组 let scale = 1; let echartData = [{ name: 'A类', value: 30, unit: '元' }, { name: 'B类', value: 20, unit: '元' }, { name: 'C类', value: 30, unit: '元' } ]; let total = echartData.reduce((a, b) => { return a + b.value * 1 }, 0) option = { backgroundColor: bgColor, color: color, title: { text: '异常分布情况', x: 'center', y: 'center', textStyle: { fontWeight: 'normal', fontSize: 24 * scale, color: "#fff", } }, tooltip: { show: false }, legend: { icon: 'rect', itemWidth: 14 * scale, itemHeight: 14 * scale, orient: 'vertical', top: 'center', right: 30, formatter: function(name) { let res = echartData.filter(v => v.name === name); res = res[0]; let percent = (res.value * 100 / total).toFixed(2); return '{percent|' + percent + '}{unit| %}\n' + res.name + '{value|' + res.value + '}' + (res.unit || '') }, textStyle: { color: '#fff', fontSize: 12 * scale, align: 'right', padding: [0, 0, 20 * scale, 0], rich: { percent: { fontSize: 22 * scale, color: '#ffe400', align: 'right' }, unit: { fontSize: 14 * scale, align: 'right', padding: [0, 0, 4 * scale, 0] }, value: { fontSize: 14 * scale, align: 'right', padding: [0, 5 * scale, 0, 30 * scale] } } } }, series: [{ type: 'pie', name: '最内层径向渐变圆心', clockWise: false, radius: '45%', center: ['50%', '50%'], z: 1, itemStyle: { normal: { color: new echarts.graphic.RadialGradient(.5, .5, .6, [{ offset: 0, color: gradientColor[0] }, { offset: 1, color: gradientColor[1] || bgColor } ], false) }, }, hoverAnimation: false, label: { show: false, }, tooltip: { show: false }, data: [100], }, { type: 'pie', name: '内层细圆环1', radius: ['46%', '46%'], hoverAnimation: false, clockWise: false, itemStyle: { normal: { borderColor: circleColor, borderWidth: 1, } }, label: { show: false }, data: [100] }, { type: 'pie', name: '内层细圆环2', radius: ['42%', '42%'], hoverAnimation: false, clockWise: false, itemStyle: { normal: { borderColor: circleColor, borderWidth: 1, } }, label: { show: false }, data: [100] }, { type: 'pie', name: '最外层细圆环', hoverAnimation: false, clockWise: false, radius: ['60%', '60%'], itemStyle: { normal: { borderColor: circleColor, borderWidth: 1, } }, label: { show: false }, data: [100] }, { name: '饼图内容区', type: 'pie', clockWise: false, radius: ['50%', '56%'], hoverAnimation: false, data: echartData, itemStyle: { normal: { shadowBlur: 20, shadowColor: '#00204', } }, label: { show: false } } ] };