Reputation: 67
How to remove the G sign below for zero
Upvotes: 0
Views: 39
Reputation: 17791
You need to use the label formatter()
function.
This will required that you create the logic to use the abbreviation yourself as well, however.
Example:
yAxis: {
labels: {
formatter: function() {
return this.value == 0 ? 0 : this.value / 1000000000 + 'G';
}
}
}
Fiddle:
Something more flexible could look like this:
yAxis: {
labels: {
formatter: function() {
var val;
if(this.value > 1000000000 ) {
val = this.value / 1000000000 + 'B';
}
else if(this.value > 1000000) {
val = this.value / 1000000 + 'M';
}
else if(this.value > 1000) {
val = this.value / 1000 + 'k';
}
else {
val = this.value;
}
return this.value == 0 ? 0 : val;
}
}
}
updated fiddle:
Upvotes: 1