There is no way to make the charts dynamically shorten the axis values.
The best you can do is modify your data to put it in the scale you want
and then manually append the 'Million' in the axis format. Something like
this:
// this assumes that you have already formatted the data in the DataTable
var view = new google.visualization.DataView(data);
view.setColumns([0, {
label: data.getColumnLabel(1),
type: 'number',
calc: function (dt, row) {
// reformat the data in millions
return {v: dt.getValue(row, 1) / 1000000, f: dt.getFormattedValue(
row, 1)};
}
}]);
chart.draw(view, {
vAxis: {
// format the axis values to millions
format: '### Million'
}
});
There is no way to have the charts change from millions to billions (or
other values) without explicitly changing the format and redrawing (ie, the
axis values can't be: ...800M, 900M, 1B, 1.1B...)
On Monday, June 18, 2012 6:12:05 PM UTC-4, Zhengli Sun wrote:
>
> I have large numbers on Y axis in my data.
>
> I want to make it show as 20Million instead of 20,000,000. How can I write
> the formatter?
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/_SkQtdifczcJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.