In my HighChart line graphs, the series data is being fed from my Ruby on Rails application dynamically. Sometimes the series values are zeros or less which is a problem fo
Have you tried using a label formatter?
var chart = new Highcharts.Chart({
yAxis: {
labels: {
formatter: function() {
if(this.value === 0.00001){
return 0;
} else {
return this.value;
}
}
}
}
});
When dealing with huge numbers, it's better to use the standard label formatter for values other than 0, otherwise your labels gonna be displayed like this: 1000000000... To change this replace 'else' statement to the call to the original label formatter method below:
var chart = new Highcharts.Chart({
yAxis: {
labels: {
formatter: function() {
if(this.value === 0.00001){
return 0;
} else {
return Highcharts.Axis.prototype.defaultLabelFormatter.call(this);
}
}
}
}
});