Reputation: 1638
https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart#Example
How can I add units to the vertical axis like "$" or "€"? In the example, it should be 1.200 $, 1.000 $, 800 $, 600 $ and 400 $.
Just adding '$' like this doesn't work:
var data = google.visualization.arrayToDataTable([
['Year', 'Sales', 'Expenses'],
['2004', 1000 '$', 400],
['2005', 1170 '$', 460],
['2006', 660 '$', 1120],
['2007', 1030 '$', 540]
]);
I know, it's a bad example as sales doesn't have any unit, but it's just an example.
Upvotes: 8
Views: 9897
Reputation: 3215
I stumbled onto this question and found that the newer Google Sheets (2017) has an "Advanced Edit" option for Grids/Charts. Click the down arrow in the upper-right, and you'll see it. The last tab on that interface lets you set custom prefix/suffix for data Axes if you scroll down.
Upvotes: 0
Reputation: 1313
You need to add a format tag to your graph options as follows:
var options = {
vAxis: {format:'# $'}
};
Reference: https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart#Configuration_Options
Upvotes: 19