Extend JS to include currency code #37

This commit is contained in:
James Cole
2014-12-24 06:10:39 +01:00
parent c2dd61e96b
commit fe1fb23e5b
10 changed files with 57 additions and 51 deletions

View File

@@ -14,7 +14,7 @@ function googleLineChart(URL, container, options) {
var money = new google.visualization.NumberFormat({
decimalSymbol: ',',
groupingSymbol: '.',
prefix: '\u20AC '
prefix: currencyCode + ' '
});
for (i = 1; i < gdata.getNumberOfColumns(); i++) {
money.format(gdata, i);
@@ -52,7 +52,7 @@ function googleBarChart(URL, container, options) {
var money = new google.visualization.NumberFormat({
decimalSymbol: ',',
groupingSymbol: '.',
prefix: '\u20AC '
prefix: currencyCode + ' '
});
for (i = 1; i < gdata.getNumberOfColumns(); i++) {
money.format(gdata, i);
@@ -90,7 +90,7 @@ function googleColumnChart(URL, container, options) {
var money = new google.visualization.NumberFormat({
decimalSymbol: ',',
groupingSymbol: '.',
prefix: '\u20AC '
prefix: currencyCode + ' '
});
for (i = 1; i < gdata.getNumberOfColumns(); i++) {
money.format(gdata, i);
@@ -113,43 +113,6 @@ function googleColumnChart(URL, container, options) {
}
}
function googleStackedColumnChart(URL, container, options) {
if ($('#' + container).length == 1) {
$.getJSON(URL).success(function (data) {
/*
Get the data from the JSON
*/
gdata = new google.visualization.DataTable(data);
/*
Format as money
*/
var money = new google.visualization.NumberFormat({
decimalSymbol: ',',
groupingSymbol: '.',
prefix: '\u20AC '
});
for (i = 1; i < gdata.getNumberOfColumns(); i++) {
money.format(gdata, i);
}
/*
Create a new google charts object.
*/
var chart = new google.visualization.ColumnChart(document.getElementById(container));
/*
Draw it:
*/
chart.draw(gdata, options || defaultStackedColumnChartOptions);
}).fail(function () {
$('#' + container).addClass('google-chart-error');
});
} else {
console.log('No container found called "' + container + '"');
}
}
function googleComboChart(URL, container, options) {
if ($('#' + container).length == 1) {
$.getJSON(URL).success(function (data) {
@@ -164,7 +127,7 @@ function googleComboChart(URL, container, options) {
var money = new google.visualization.NumberFormat({
decimalSymbol: ',',
groupingSymbol: '.',
prefix: '\u20AC '
prefix: currencyCode + ' '
});
for (i = 1; i < gdata.getNumberOfColumns(); i++) {
money.format(gdata, i);
@@ -201,7 +164,7 @@ function googlePieChart(URL, container, options) {
var money = new google.visualization.NumberFormat({
decimalSymbol: ',',
groupingSymbol: '.',
prefix: '\u20AC '
prefix: currencyCode + ' '
});
for (i = 1; i < gdata.getNumberOfColumns(); i++) {
money.format(gdata, i);