我正在使用柱形图,并将这些值显示在每个条形图的顶部。我不想显示值是否为0。该怎么做?这是我的代码
var series = { data: [],
dataLabels: {
enabled: true,
color: 'black',
align: 'right',
x: -3,
y: 3,
style: {
color: '#333',
fontWeight: 'bold',
fontSize: '12px',
fontFamily: 'Trebuchet MS, Verdana, sans-serif'
}
},
pointWidth: 28
};
最佳答案
您可以使用格式化程序。这样的事情应该做到:
dataLabels: {
formatter:function() {
if(this.y != 0) {
return this.y;
}
}
}
http://api.highcharts.com/highcharts#plotOptions.series.dataLabels.formatter
关于highcharts - 如何在柱形图中隐藏零值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15834687/