Google Line Chart: How to add units?

google-visualization

Solution

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

Problem

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.

Original source