我正在使用柱形图并将这些值显示在每个条形的顶部。如果值为 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 http://api.highcharts.com/highcharts#plotOptions.series.dataLabels.formatter
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)