Echarts柱状图的每个柱体显示不同颜色

上一波代码示意图,黑色标注是主要设置柱体颜色的当柱子比颜色数组长度多时,会循环取色

option = {
    xAxis: {
        type: 'category',
        data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
    },
    yAxis: {
        type: 'value'
    },
    series: [{
        data: [120, 200, 150, 80, 70, 110, 130],
        type: 'bar',
         showBackground: true,
        barMaxWidth:'30%',
        itemStyle:{
            normal:{
                color:function(params){
                    var colorlist = ['#DA251D','#E67716','#FBC300','#11440f','#32585a','#00ff77'];
                    return colorlist[params.dataIndex];
                }
            }
        }

    }]
};
效果如图:

Echarts柱状图的每个柱体显示不同颜色