我希望如果该值低于 300,则对齐必须“正确”并且条形的颜色将为黄色。
我需要为每个类别制定这个条件。但是,我不知道该怎么做。
plotOptions: {
bar: {
dataLabels: {
padding:0,
allowOverlap:true,
enabled: true,
align: 'left',
color: '#FFFFFF',
inside: true,
crop: false,
overflow:"none",
formatter: function() {
return this.series.name+ " "+ this.y;
console.log(this.series.name);
},
style:{
width:100
}
}
}
}
最佳答案
我至少可以解决一半的问题。但无法弄清楚如何将文本对齐方式绑定(bind)到值。
黄色条,如果值低于 300
在每个 系列中使用zones
属性:
series: [{
name: 'bar3',
data: [600,540,535,500,0],
color: "#00FF00",
// Append this to each series:
zones: [{
// Make it yellow if <= 300
color: '#f0e600',
value: 300
}]
}]
关于javascript - 根据值 HIGHCHARTS 放置条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34769577/