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];
}
},
},
}]
echarts给柱形图的每个柱子设置不同颜色
最新推荐文章于 2023-12-13 15:15:05 发布
本文介绍如何在ECharts中为柱状图系列设置不同的颜色。通过使用特定的JavaScript函数,可以根据数据索引来选择预定义的颜色列表中的颜色。

8588

被折叠的 条评论
为什么被折叠?



