echarts 柱狀圖顏色

option = {
 
title: {
    text: '某地區(qū)降水量',
    subtext: '純屬虛構(gòu)'
},
tooltip: {
    trigger: 'axis'
},
grid: {
    left: '3%',
    right: '4%',
    bottom: '3%',
    containLabel: true
},
xAxis: [{
    type: 'category',
    data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
    splitLine: {
        show: false
    },
    axisTick: {
        alignWithLabel: true
    }
}],
yAxis: [{
    type: 'value',
    splitLine: {
        show: false
    },
    splitArea: {
        show: true,
    },
}],
series: [{
    name: '降水量',
    type: 'bar',
    label: {
        normal: {
            show: true,
            position: 'top'
        }
    },
    itemStyle: {
        normal: {
            // 隨機(jī)顯示
            //color:function(d){return "#"+Math.floor(Math.random()*(256*256*256-1)).toString(16);}
          
            // 定制顯示(按順序)
            color: function(params) { 
                var colorList = ['#C33531','#EFE42A','#64BD3D','#EE9201','#29AAE3', '#B74AE5','#0AAF9F','#E89589','#16A085','#4A235A','#C39BD3 ','#F9E79F','#BA4A00','#ECF0F1','#616A6B','#EAF2F8','#4A235A','#3498DB' ]; 
                return colorList[params.dataIndex] 
            }
        },
    },
    data: [32.6, 25.9, 39.0, 26.4, 28.7, 70.7, 75.6, 82.2, 48.7, 58.8, 16.0, 32.3],
}]
};
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容