ECharts关于堆叠柱状图的使用

最近在做一个项目需要用到echarts,所以一边学习ECharts官网上的中文API(http://echarts.baidu.com/examples.html),然后一些细节部分如果没有我就再搜各位前辈写的代码,总算将功能实现出来了,下面就是我的代码以及最终效果图。
先看效果图:
堆叠柱状图
有时候我们需要用到堆叠柱状图的效果,所以看代码、如下:

series: [
                {
                    name:"用户数",
                    type:'bar',
                    stack:'123',
                    //颜色渐变
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: '#71E2E5'
                    }, {
                        offset: 1,
                        color: '#C3F3F4'
                    }]),
                    data:[700, 409, 700, 232, 256, 767, 135.6, 162.2],                 
                    barWidth : 10,
                    itemStyle: {                
                        emphasis: {
                            barBorderRadius:[10, 10, 10, 10]
                        },
                        normal: {
                            //柱形图圆角,初始化效果
                            barBorderRadius:[10, 10, 10, 10],                     
                        }
                    },
                },
                {
                    name:"用户数",
                    type:'bar',
                     stack:'123',
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,

                        color: '#EFC1B7'
                    }, {
                        offset: 1,
                        color: '#FBEBE7'
                    }]),
                    data:[700, 129, 70, 32, 56, 67, 35.6, 163.2],                  
                    barWidth : 10,
                    itemStyle: {
                        emphasis: {
                            barBorderRadius:[10, 10, 10, 10]
                        },
                        normal: {
                            //柱形图圆角,初始化效果
                            barBorderRadius:[10, 10, 10, 10],
                           
                        }
                    },
                },
                

``在这里插入图片描述
这里只需要在每一个里面添加一个stack属性即可,希望能够帮助到你们。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值