EChart案例-圆形环比图

 效果:

 

配置options:

let data=[
       {
            value: 20,
            name: '水质',
            itemStyle:{
              normal: {
                color:'#40a7e9'
              }
           }
        }, {
            value: 35,
            name: '流量',
            itemStyle:{
                normal: {
                  color:'#f4c052'
                }
            }
        }, {
            value: 25,
            name: '状态',
            itemStyle:{
                normal:{
                  color: '#6ed971'
                }
            }
        }, {
            value: 15,
            name: '水位',
            itemStyle:{
                normal: {
                  color:'#f38051'
                }
            }
        }
     ]
     let  option = {
     title: {
        text: '',
      },
     legend:{
       data:['水质','流量','状态','水位',],
       bottom:10,
       left:90,
       orient:'vertical',
       itemGap:25,
       formatter(name){
         let item=data.find(node=>node.name==name);
         return [
                   '{title|'+item.name+'}{value|'+item.value+'%}{value|'+item.value+'}'

                ].join('\n')
       },
       textStyle:{
         color:'#fff',
         fontSize:18,

         rich: {
                 title: {
                   color: '#73a1b0',
                   align: 'left',
                   fontSize:22,
                   width:165,
                },
                value: {
                   color: '#fff',
                   align: 'left',
                   fontSize:26,
                   width:165,
                   fontFamily:'Helvetica'
                },

         }

       }
     },
     series: [{
        z:10,
        type: 'pie',
        center:['50%', '35%'],
        radius: ['45%', '55%'],
        startAngle: 135,
        itemStyle : {
          normal : {
            label : {
              show : false
            },
            labelLine : {
              show : false
            }
          },

        },
        data:data
    },
    { //内圆
    type: 'pie',
    center:['50%', '35%'],
    radius: '40%',
    itemStyle: {
        normal: {
              color: new echarts.graphic.RadialGradient(.5, .5, .8, [{
                    offset: 0,
                    color: '#0a2957'
                },
                {
                    offset: .52,
                    color: '#0a2957'
                },
                {
                    offset: 1,
                    color: '#71a8ca'
                }
            ], false),

            shadowColor: '#71a8ca',
            shadowBlur: 12,
            label: {
                show:true,
                position:'center',
                  textStyle: {
                    color: '#fff',
                    fontSize: 30,
                    fontWeight:400,
                },
            },
            labelLine: {
                show: false
            }
        },
    },
    hoverAnimation: false,
    label: {
        show: true,
    },
    tooltip: {
        show: false
    },
    data: [{name:'100',value:0}],
},

    ]
};

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值