echars连续堆叠柱状图

const colorList = [
  '#4f81bd',
  '#c0504d',
  '#4f81bd',
  '#4f81bd',
  '#4f81bd',
  '#4f81bd'
];
option = {
  title: {
    text: 'Profit',
    left: 'center'
  },
  tooltip: {},
  xAxis: {
     type: 'category',
    data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    
  },
  series: [
     {
      name: 'Direct',
      type: 'bar',
      stack: 'total',
      label: {
        show: true
      },
      emphasis: {
        focus: 'series'
      },
      data: [100, 100, 100, 100, 100, 100, 100],
      barCategoryGap:'0%',
          itemStyle: {
                normal: {
                    color: function(params) {
                        // 给出颜色组
                        return colorList[params.dataIndex]
                    },
                }
            },
    },
    {
      name: 'Mail Ad',
      type: 'bar',
      stack: 'total',
      label: {
        show: true
      },
      emphasis: {
        focus: 'series'
      },
       data: [100, 100, 100, 100, 100, 100, 100],
       barCategoryGap:'0%',
       itemStyle: {
                normal: {
                    color: function(params) {
                        // 给出颜色组
                        return colorList[params.dataIndex]
                    },
                }
            },
          
    },
    {
      name: 'Affiliate Ad',
      type: 'bar',
      stack: 'total',
      label: {
        show: true
      },
      emphasis: {
        focus: 'series'
      },
        data: [100, 100, 100, 100, 100, 100, 100],
       barCategoryGap:'0%',
           itemStyle: {
                normal: {
                    color: function(params) {
                        // 给出颜色组
                        return colorList[params.dataIndex]
                    },
                }
            },
    }
  ]
};

版权声明:本文为weixin_42367288原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。