echarts给柱形图的每个柱子设置不同颜色

 series: [{
                type: 'bar',
                data: [5, 20, 36, 10, 10, 20],
                 itemStyle: {
                    normal:{  
                    color: function (params){
                        var colorList = ['#ff4844','#9ac3e5','#66ac52','#ffc032','#549bd3','#f47e39'];
                        return colorList[params.dataIndex];
                    }
                },
              },
        }]

猜你喜欢

转载自blog.csdn.net/cherish_all/article/details/77646203