首页 > 其他 > 详细

柱形图添加背景色

时间:2020-03-30 18:56:05      阅读:64      评论:0      收藏:0      [点我收藏+]
test(){
      this.carTotalEc = this.$echarts.init(this.$refs.boxEc)
      var option = {
        title: {
            text: ‘世界人口总量‘,
            subtext: ‘数据来自网络‘
        },
        tooltip: {
            trigger: ‘axis‘,
            axisPointer: {
                type: ‘shadow‘
            }
        },
        legend: {
            data: [‘2011年‘, ‘2012年‘]
        },
        grid: {
            left: ‘3%‘,
            right: ‘4%‘,
            bottom: ‘3%‘,
            containLabel: true
        },
        xAxis: {
            type: ‘value‘,
            boundaryGap: [0, 0.01]
        },
        yAxis: {
            type: ‘category‘,
            data: [‘巴西‘, ‘印尼‘, ‘美国‘, ‘印度‘, ‘中国‘, ‘世界人口(万)‘]
        },
        series: [
            {
                name: ‘2011年‘,
                type: ‘bar‘,
                data: [18203, 23489, 29034, 104970, 131744, 630230],
                showBackground: true,
                backgroundStyle: {
                    color: ‘#ff0‘
                }
            },
            {
                name: ‘2012年‘,
                type: ‘bar‘,
                barWidth: ‘20%‘,
                data: [19325, 23438, 31000, 121594, 134141, 681807],
                showBackground: true,
                backgroundStyle: {
                    color: ‘#ff0‘
                }
            }
        ]
      };
      
      this.carTotalEc.setOption(option);

    }

 

版本4.7.0

 效果

技术分享图片

 

柱形图添加背景色

原文:https://www.cnblogs.com/xhrr/p/12600137.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!