echarts进度条制作

直接上图

横向的,可以放到组件的,不需要太高

option = {
    grid: { left: '5%', top: '5', right: '25%', bottom: '5' },
    xAxis: {
      type: 'value',
      show: false,
      max: 100, // 最大值值用机组的maxNumber,保证柱子背景长度
    },
    yAxis: [
      {
        type: 'category',
        position: 'right',
        inverse: true,
        axisTick: 'none',
        axisLine: 'none',
        show: true,
        axisLabel: {
          textStyle: {
            color: '#333333',
          },
          formatter: function (params) {
            return `${params}`;
          },
        },
        data: ['25'],
      },
    ],
    series: [
      {
        name: '正数',
        type: 'bar',
        stack: '总量',
        barWidth: 12,
        barMinHeight: 20,
        silent: true, // 禁止点击事件
        showBackground: true,
        backgroundStyle: {
          // 柱子背景设置
          borderRadius: [30, 30, 30, 30],
          color: '#e7e7e7',
        },
        emphasis: {
          focus: 'series',
        },
        data: ['25'],
        itemStyle: {
          normal: {
            barBorderRadius: [30, 30, 30, 30],
            label: {
              show: false,
              position: 'right',
              formatter: function (params) {
                var val1 = params.value + '' + unit;
                return val1;
              },
            },
            color:'yellow',
          },
        },
      },
      {
        name: '正数',
        type: 'bar',
        stack: '总量',
        barWidth: 12,
        barMinHeight: 20,
        silent: true, // 禁止点击事件
        showBackground: true,
        backgroundStyle: {
          // 柱子背景设置
          borderRadius: [30, 30, 30, 30],
          color: '#e7e7e7',
        },
        emphasis: {
          focus: 'series',
        },
        data: ['15'],
        itemStyle: {
          normal: {
           
            label: {
              show: false,
              position: 'right',
              formatter: function (params) {
                var val1 = params.value + '' + unit;
                return val1;
              },
            },
            color: 'red'
          },
        },
      },
      {
        name: '正数',
        type: 'bar',
        stack: '总量',
        barWidth: 12,
        barMinHeight: 20,
        silent: true, // 禁止点击事件
        showBackground: true,
        backgroundStyle: {
          // 柱子背景设置
          borderRadius: [30, 30, 30, 30],
          color: '#e7e7e7',
        },
        emphasis: {
          focus: 'series',
        },
        data: ['15'],
        itemStyle: {
          normal: {
           
            label: {
              show: false,
              position: 'right',
              formatter: function (params) {
                var val1 = params.value + '' + unit;
                return val1;
              },
            },
            color: 'green'
          },
        },
      },
      {
        name: '正数',
        type: 'bar',
        stack: '总量',
        barWidth: 12,
        barMinHeight: 20,
        silent: true, // 禁止点击事件
        showBackground: true,
        backgroundStyle: {
          // 柱子背景设置
          borderRadius: [30, 30, 30, 30],
          color: '#e7e7e7',
        },
        emphasis: {
          focus: 'series',
        },
        data: ['15'],
        itemStyle: {
          normal: {
            label: {
              show: false,
              position: 'right',
              formatter: function (params) {
                var val1 = params.value + '' + unit;
                return val1;
              },
            },
            color: 'blue'
          },
        },
      },
    ],
  };

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值