Toggle navigation
仪表图 pie gauge
By
YYJJPQ
2017-11-02 06:00:27
脚本
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
图表已生成
整理代码
刷新
代码
var type = '不合格'; var val = 80; option = { tooltip: { formatter: "{a}
{b} : {c}%" }, series: [{ //背景刻度 name: '背景刻度', type: 'gauge', splitNumber: 10, //刻度数量 min: 0, max: 100, radius: '70%', //刻度尺寸略小 endAngle: -45, zlevel: 20, axisLine: { show: false, lineStyle: { width: 0, shadowBlur: 0, color: [ [1, '#ccc'] ] } }, axisTick: { show: true, lineStyle: { color: '#ddd', width: 1 }, length: 10, splitNumber: 3 }, splitLine: { show: true, length: 20, lineStyle: { color: '#aaa' } }, axisLabel: { show: false, }, detail: { show: false } }, { //进度轴线 name: '进度', type: 'gauge', radius: '80%', //进度轴尺寸略大 endAngle: -45, zlevel: 40, animationEasing: 'bounceInOut', animationDelay: function(idx) { return idx * 1000; }, axisLine: { show: false, lineStyle: { width: 0, shadowBlur: 0, color: [ [1, '#ccc'] ] } }, axisTick: { show: false }, splitLine: { show: false }, axisLabel: { show: false }, detail: { offsetCenter: [ 0, '90%' ], // x, y,单位px textStyle: { fontWeight: 400, color: '#fa4936', fontSize: 30 }, formatter: '{value}%' }, pointer: { show: true, length: '70%', width: 14 }, // 其他演示在itemStyle中调试 // 不是整个canvas的title title: { color: '#fa4936', fontSize: 30, fontWeight: 400, offsetCenter: [0, '-50%'] }, data: [ // data数据为实时数据 { name: type, value: val } ] }, { name: '进度展示条', type: 'pie', radius: ['71%', '79%'], avoidLabelOverlap: false, silent: true, startAngle: 225, zlevel: 1, animationEasing: 'bounceIn', animationDelay: function(idx) { return idx * 1000; }, label: { normal: { show: false }, emphasis: { show: false } }, labelLine: { normal: { show: false } }, data: [{ // 展示数据 value: val * 2.7, //270(度数)*80(展示数据具体值)*0.01(百分占比常数) name: '显示进度条', itemStyle: { normal: { color: { type: 'linear', x: 0, y: 0, x2: 0, y2: 1, colorStops: [{ offset: 0, color: '#f84fa6' // 0% 处的颜色 }, { offset: 1, color: '#f88a4e' // 100% 处的颜色 }], globalCoord: false // 缺省为 false }, shadowColor: 'rgba(0, 0, 0, 0.2)', shadowBlur: 10 } } }, { // 空白数据 value: 270 * (1 - val * 0.01), //270*(1-80*0.01) name: '隐藏进度条', itemStyle: { normal: { color: '#eaeaea', shadowColor: 'rgba(0, 0, 0, 0.1)', shadowBlur: 10 } } }, { // 占位数据(写死) value: 90, name: '空白部分', itemStyle: { normal: { color: '#eee' } } }] }] };