var data_d = [];
//能确定柱子的最大数量时 根据给不同类型给不同的颜色
for (var b = 0; b < bar.length; b++) {
if (bar[b] == "不合格") {
var data_style = {
type: 'bar',
barWidth: 25,
barMaxWidth: 30,
barGap: '50%',
label: {
show: true,
position: 'top',
color: 'balck'
},
itemStyle: {
//borderColor: '#000',
color: 'red',
borderColor: 'white',
borderWidth: 1,
borderType: 'solid',
barBorderRadius: 3,
opacity: 1
}
};
data_d.push(data_style);
}
else if (bar[b] == "合格") {
var data_style = {
type: 'bar',
barWidth: 25,
barMaxWidth: 30,
barGap: '50%',
label: {
show: true,
position: 'top',
color: 'balck'
},
itemStyle: {
//borderColor: '#000',
color: 'DarkKhaki',
borderColor: 'white',
borderWidth: 1,
borderType: 'solid',
barBorderRadius: 3,
opacity: 1
}
};
data_d.push(data_style);
}
else if (bar[b] == "良好") {
... ...
}
}