New charts + tests.

This commit is contained in:
James Cole
2014-07-09 12:56:06 +02:00
parent 138044fb41
commit 5645f7a893
9 changed files with 301 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
function drawChart(id,URL,opt) {
function drawChart(id,URL,type,opt) {
$.getJSON(URL).success(function (data) {
$(id).removeClass('loading');
@@ -7,7 +7,17 @@ function drawChart(id,URL,opt) {
var money = new google.visualization.NumberFormat({decimalSymbol: ',', groupingSymbol: '.', prefix: '€ '});
money.format(gdata, 1);
var gID = id.substring(1);
var chart = new google.visualization.LineChart(document.getElementById(gID));
var chart;
switch(type) {
default:
case 'LineChart':
chart = new google.visualization.LineChart(document.getElementById(gID));
break;
case 'PieChart':
chart = new google.visualization.PieChart(document.getElementById(gID));
break;
}
chart.draw(gdata, opt);