Reputation: 1512
I've built a google chart and got really big numbers, 10^30 and higher. How do I format them so that users can understand something?
I already built a function:
console.log(bigNum(1000000000));
gives me 1 billion. Is it even possible to use own functions?
Thanks for help
Upvotes: 0
Views: 114
Reputation: 26340
You can't use the vAxis.format
option to do this, but you can specify your own axis tick marks and labels using the vAxis.ticks
option:
// create array of tick mark objects for values 0 to 10 billion every 1 billion
var ticks = [], val;
for (var i = 0; i < 11; i++) {
val = i * 1000000000;
ticks.push({v: val, f: bigNum(val)});
}
and then in the chart options:
vAxis: {
ticks: ticks
}
Upvotes: 1