设置stack后,两个bar并排显示,而不是堆叠显示~

来源:2-12 累计用户数组件开发1

菜卷_

2022-03-16

图片描述
对比了好多次,写的没问题啊,但是为啥是并排显示的。。提问区的方法也没用啊~

chart.setOption({
      xAxis: {
        type: "value",
        show: false,
      },
      yAxis: {
        type: "category",
        show: false,
      },
      series: [
        {
          type: "bar",
          stack: "总量",
          data: [200],
          barWidth: 10,
        },
        {
          type: "bar",
          stack: "总量",
          data: [250],
        },
      ],
      grid: {
        top: 0,
        left: 0,
        bottom: 0,
        right: 0,
      },
    });
写回答

3回答

慕哥9542403

2022-04-06

series: [{
        type: 'bar',
        data: [200],
        barWidth: '10px',
        itemStyle: {
          color: '#45c946'
        }
      },
      {
        type: 'bar',
        data: [250],
        barWidth: '10px',
        barGap: '-100%',
        z: "-1",
        itemStyle: {
          color: '#eee'
        }
      }]


1
2
慕盖茨9018266
回复
qq_慕虎1066881
series: [{ type: 'bar', data: [200], z: 10, barWidth: 10, itemStyle: { color: '#45c946' } }, { type: 'bar', data: [250], barWidth: 10, barGap: '-100%', itemStyle: { color: '#eee' } }]
2022-05-29
共2条回复

真的太虚了

2022-05-15

第二个bar的data设置为50

0
0

SunShineQQ

2022-03-29

设置一个stack是不行的,添加一个

barGap


0
0

Vue + EChart 4.0 从0到1打造商业级数据报表项目

数据可视化是未来前端技术的标配,是未来前端竞争的破冰利器

5701 学习 · 79 问题

查看课程