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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With