echarts 仪表盘自定义指针颜色

var myChart = echarts.init(document.getElementById('main2'));

      var option = {

        tooltip: {

          formatter: '{a} <br/>{b} : {c}'

        },

        title: {

          text: '日用电CO2排放总量,ton\n黄色目标值,蓝色实际值',

          show: true,

          x: 'center', //水平安放位置,默认为'left',可选为:'center' | 'left' | 'right' | {number}(x坐标,单位px)

          y: 'bottom', //

          padding: [0, 0, 0, 0],

          textStyle: {       // 其余属性默认使用全局文本样式,详见TEXTSTYLE

            color: '#FFFFFF',

            fontSize: 'calc(100vh *14 / 1080)',

          }

        },

        series: [

          {

            name: '业务指标',

            type: 'gauge',

            min: 0,

            max: (this.stysum * 0.766 / 1000.00).toFixed(2),

            axisLine: {

              lineStyle: {

                width: 20,

                color: [[0.2, 'rgb(0,198,136)'], [1, 'rgb(46,139,200)']]

              }

            },

            splitNumber: 1,

            axisLabel: {

              show: true,

              distance: -65,

              textStyle: {       // 属性lineStyle控制线条样式

                // fontWeight: 'bolder',

                color: 'yellow',

                shadowColor: 'rgb(46, 139, 200)', //默认透明

                shadowBlur: 5

              }

            },

            axisTick: {            // 坐标轴小标记

              show: false

            },

            splitLine: {

              length: 44,

              lineStyle: {

                color: 'auto',

                width: 0

              }

            },

            detail: {

              formatter: '{value}',

              offsetCenter: ["0", "70%"],

              textStyle: {       // 其余属性默认使用全局文本样式,详见TEXTSTYLE

                color: 'rgb(46,139,200)',

                // fontWeight: 'bolder'

                fontSize: 'calc(100vh *30 / 1080)'

              }

            },

            radius: "95%",

            data: [{ value: (this.lfl1 * 0.766 / 1000.00).toFixed(2), name: '' ,itemStyle:{color:‘red’}}]//修改指针颜色

          }

        ]

      };

      // 使用刚指定的配置项和数据显示图表。

      myChart.setOption(option, true);

      window.addEventListener("resize", () => {

        myChart.resize();

      });

  • 10
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值