echarts实现堆叠图(这里主要是轴线,标签,刻度线,分割线的区分标注)---- 推荐阅读

option = {
    // backgroundColor: '#000',
    legend: {
        data: ['销售费用率', '管理费用率','财务费用率','研发费用率'],
        bottom: 0,
        left:'center',
        textStyle:{
            fontSize: 12,
            color: '#409AAA',
            rich: {
                b: {color:'red'}
            }
        },
        icon: 'rec',
        itemHeight: 5,
        itemWidth: 8
    },
    grid: {
        left: '5%',
        right: '5%',
        bottom: '6%',
        containLabel: true
    },
    xAxis:  {
        type: 'value',
        //x轴示坐标轴轴线
        axisLine: { 
            show: true,
            lineStyle: {
                color: '#BFBFBF'  //x轴坐标颜色
            }
        },
        //x轴刻度标签数字
        axisLabel: { 
            show:true,
            textStyle: {
                color: '#409AAA'  //x轴标签颜色
            }
        },
        //x轴刻度
        axisTick: { show: false},
        //x轴分割线(这里是虚线)
        splitLine: {
            lineStyle: {
                type: 'dashed',
                width: 0.5,
                color: '#21506F' 
            }
        }
    },
    yAxis: {
        type: 'category',
        data: ['2018','2019'],
        //y轴示坐标轴轴线
        axisLine: { 
            show: true,
            lineStyle: {
                color: '#BFBFBF'  //y轴坐标颜色
            }
        },
         //y轴刻度标签数字
        axisLabel: { 
            show:true,
            textStyle: {
                color: '#409AAA'  //y轴标签颜色
            }
        },
        //y轴刻度
        axisTick: { show: false },
        //y轴分割线
        splitLine: {show: false}
    },
    // inverse: true,
    series: [
        {
            name: '销售费用率',
            type: 'bar',
            stack: '总量',
            barWidth: 30,
            itemStyle:{
                normal: {
                    color: '#00DDFF',
                    shadowBlur: 5,
                    shadowColor: 'rgba(0,221,255,0.3)',
                    shadowOffsetX: -5,
                    shadowOffsetY: -5
                }
            },
            z:  10,
            data: [100, 100]
        },
        {
            name: '管理费用率',
            type: 'bar',
            stack: '总量',
            itemStyle:{
                normal: {
                    color: '#FFD700',
                    shadowBlur: 5,
                    shadowColor: 'rgba(255,215,0,0.3)',
                    shadowOffsetX: -5,
                    shadowOffsetY: -5
                }
            },
            z: 5,
            data: [100, 100]
        },
        {
            name: '财务费用率',
            type: 'bar',
            stack: '总量',
            itemStyle:{
                normal: {
                    color: '#FF721F',
                    shadowBlur: 5,
                    shadowColor: 'rgba(255,114,31,0.3)',
                    shadowOffsetX: -5,
                    shadowOffsetY: -5
                }
            },
            z: 2,
            data: [100, 100]
        },
        {
            name: '研发费用率',
            type: 'bar',
            stack: '总量',
            itemStyle:{
                normal: {
                    color: '#06FFAE',
                    shadowBlur: 5,
                    shadowColor: 'rgba(6,255,174,0.3)',
                    shadowOffsetX: -5,
                    shadowOffsetY: -5
                }
            },
            // label: {
            //     normal: {
            //         show: true,
            //         position: 'right',
            //         color: '#94E4FF'
            //     }
            // },
            z: 1,
            data: [100, 100]
        }
    ]
};

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值