echart叠加柱状图上显示文字

echart叠加柱状图上显示文字

效果图

在这里插入图片描述

修改代码

在这里插入图片描述

源代码

option = {
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器,坐标轴触发有效
            type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
        }
    },
    legend: {
        data: [ '邮件营销', '联盟广告', '视频广告']
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: [
        {
            type: 'category',
            data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
        }
    ],
    yAxis: [
        {
            type: 'value'
        }
    ],
    series: [
        {
            name: '邮件营销',
            type: 'bar',
            stack: '广告',
            label:{
                normal:{
                    show:true,
                    position:'insideRight',
                    textStyle:{
                        color:'black'
                    },
                    formatter:function(params){
                        return params.value
                    }
                }
            },
            data: [ 132, 101, 134, 90, 230, 310,112]
        },
        {
            name: '联盟广告',
            type: 'bar',
            stack: '广告',
            label:{
                normal:{
                    show:true,
                    position:'insideRight',
                    textStyle:{
                        color:'black'
                    },
                    formatter:function(params){
                        return params.value
                    }
                }
            },
            data: [220, 182, 191, 234, 290, 330, 310]
        },
        {
            name: '视频广告',
            type: 'bar',
            stack: '广告',
            label:{
                normal:{
                    show:true,
                    position:'insideRight',
                    textStyle:{
                        color:'black'
                    },
                    formatter:function(params){
                        return params.value
                    }
                }
            },
            data: [150, 232, 201, 154, 190, 330, 410]
        }
    ]
};



参考:https://www.cnblogs.com/hxjCode/p/11270139.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值