Toggle navigation
饼图
By
绿***绿
2019-08-23 01:18:17
脚本
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 DataPie2 = [{ 'name': '一级告警', 'value': 20 }, { 'name': '五级告警', 'value': 30 }, { 'name': '四级告警', 'value': 10 }, { 'name': '三级告警', 'value': 10 }, { 'name': '二级告警', 'value': 10 }, { 'name': '六级告警', 'value': 10 }, ]; let seriesPie2 = []; let colorPie2 = ['#d61616', '#00f948', '#12b4ff', '#fef119', '#ff5b00', '#00d4ff'] for (let i = 0; i < DataPie2.length; i++) { seriesPie2.push({ value: DataPie2[i].value, name: DataPie2[i].name, label: { color: '#dfe9e3' }, labelLine: { show: true, length: 10, length2: 20, lineStyle: { color: '#053256', width: 2 } }, itemStyle: { normal: { borderWidth: 5, shadowBlur: 20, borderColor: colorPie2[i], shadowColor: colorPie2[i], } } }, { value: 3, name: '', itemStyle: { normal: { label: { show: false }, color: 'transparent', } } }); } option = { backgroundColor: '#04243E', grid: { left: '1%', // 与容器左侧的距离 right: '1%', // 与容器右侧的距离 top: '1%', // 与容器顶部的距离 bottom: '1%', // 与容器底部的距离 }, series: [{ name: '', type: 'pie', clockWise: true, //饼图的扇区是否是顺时针排布。 radius: ['63%', '63.5%'], hoverAnimation: false, //关闭hover伞形变大 itemStyle: { normal: { label: { formatter: function(params) { var percent = 0; var total = 0; for (var i = 0; i < DataPie2.length; i++) { total += DataPie2[i].value; } percent = ((params.value / total) * 100).toFixed(0); if (params.name !== '') { return params.name + '\n{white|' + '占比' + percent + '%}'; } else { return ''; } }, rich: { white: { color: '#f4fff7', align: 'center', padding: [3, 0] } } }, } }, data: seriesPie2 }] };