修改单个柱子的颜色等
//在赋值的data里面写样式即可
series: [
{
type: 'bar',
color: '#53D7E6',
barWidth: 38,
data: [{value: 92844,itemStyle: {color: '#008fff'}}, 85238, 75994, 68157, 55469, 37759]
}
]
不改变柱子颜色
第一种:直接放data里面可行
datas.secondValues[i] = {
value: linePercent,
label: {
normal: {
color: numColor,
fontSize: this.height * 0.05,
},
},
};
onDataUpdate(data) {
series: [
{
data: data.secondValues,
},
],
});
}
},
secondValues包含:value,label-normal-color
注释部分就是重点
series: [
{
name: "全年规划数",
type: "bar",
data: barData,
barWidth: "30%",
itemStyle: {
normal: {
barBorderRadius: [
color: "",
label: {
show: true, //是否开启柱子顶部文字显示
position: "top", //在上方显示 文字显示方向
color: "#FFF",
fontSize: this.height * 0.07,
/* formatter: function (item, index) {//index为undefined 下标正确为item.dataIndex
let returnStr = "";
if (item.value < 3) {
returnStr = item.value + " \n ";
return "{a|" + returnStr + "}";
} else if (item.value > 3) {
return "{b|" + returnStr + "}";
} else {
return "{c|" + returnStr + "}";
}
},
rich: {
a: {
color: "orange",
},
b: {
color: "red",
},
c: {
//默认
color: "white",
},
}, */
},
},
},
},
],