Need help in changing currency

15 views
Skip to first unread message

Chethan K

unread,
Apr 25, 2017, 4:31:34 AM4/25/17
to Google Visualization API
Hi,
I have a line graph with multiple line in it, and I need to change the currency of the vAxis data. Below is the code that I tried, but I am not able to see "£0.00" instead its displaying "£.00".
Can you please let me know how to achieve this.

Code:
var data = new google.visualization.DataTable();
data.addColumn('string', 'Month');
data.addColumn('number', '2016');
data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});
data.addColumn('number', '2017');
data.addColumn({type: 'string', role: 'tooltip', 'p': {'html': true}});

data.addRow(['Jan', 10, 'Total Amount: £10.00', 113, 'Total Amount: £113.00']);
data.addRow(['Feb', 20, 'Total Amount: £20.00', 19, 'Total Amount: £19.00']);
data.addRow(['Mar', 130, 'Total Amount: £130.00', 189, 'Total Amount: £189.00']);
data.addRow(['Apr', 140, 'Total Amount: £140.00', 11, 'Total Amount: £11.00']);

var options = {
    curveType: 'none',
    legend: { position: 'bottom' },
    vAxis: {format: "£#,###.00",textStyle: {bold: 1,fontName: 'open-sans'}, viewWindow:{min: 0}, maxValue: 1000},
    hAxis: {textStyle: {bold: 1,fontName: 'open-sans',fontSize:7}},
    width: '100%',
    pointSize : 6,
    lineWidth: 4,
    colors: ['#fca257','#014761']
};

var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);


Thanks
Screen Shot 2017-04-25 at 2.00.41 PM 1.png

Daniel LaLiberte

unread,
Apr 25, 2017, 6:48:16 AM4/25/17
to Google Visualization API
Try  "£#,##0.00" instead.  The '0' means always show a digit for that position,

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/254011ac-fd17-4e7d-bd76-702737aa2475%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Chethan K

unread,
Apr 25, 2017, 10:59:00 AM4/25/17
to Google Visualization API
Thanks Daniel, that did the trick.
To post to this group, send email to google-visua...@googlegroups.com.



--
Reply all
Reply to author
Forward
0 new messages