echarts 多个进度条合并

一下代码可以直接复制到echarts官网看效果
echarts
关键点:barGap: ‘-100%’
如果想要两个系列的柱子重叠,可以设置 barGap 为 ‘-100%’。这在用柱子做背景的时候有用。

option = {
  xAxis: {
     type: 'value',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'category',
  },
  series: [
    {
      data: [120, 200, 150, 80, 70, 110, 130],
      type: 'bar',
     barWidth:20,
      itemStyle:{
          normal: {  //normal 图形在默认状态下的样式;
              barBorderRadius: 10,//柱条圆角半径,单位px.
          }
      },
      zlevel:4
    },{
     type: 'bar',
     barWidth:20,
      itemStyle:{
          normal: {  //normal 图形在默认状态下的样式;
              barBorderRadius: 10,//柱条圆角半径,单位px.
          }
      },
     barGap: '-100%',
     data: [130, 210, 180, 80, 90, 110, 140],
      zlevel:3
    },{
     type: 'bar',
     barWidth:20,
      itemStyle:{
          normal: {  //normal 图形在默认状态下的样式;
              barBorderRadius: 10,//柱条圆角半径,单位px.
          }
      },
     barGap: '-100%',
     data: [140, 220, 190, 80, 90, 110, 140],
      zlevel:2
    },{
     type: 'bar',
     barWidth:20,
      itemStyle:{
          normal: {  //normal 图形在默认状态下的样式;
              barBorderRadius: 10,//柱条圆角半径,单位px.
          }
      },
     barGap: '-100%',
     data: [150, 230, 200, 80, 90, 110, 140],
      zlevel:1
    },
    {
    // 这块用于设置圆角的背景色的,因为知道echarts最大值,所以写死了data的值
     type: 'bar',
     barWidth:20,
      itemStyle:{
          normal: {  //normal 图形在默认状态下的样式;
              barBorderRadius: 10,//柱条圆角半径,单位px.
          }
      },
       color: '#cccccc',//柱条颜色
     barGap: '-100%',
     data: [ 250,  250,  250,  250,  250,  250, 250]
    }
  ]
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值