mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-05 21:53:08 -06:00
22 lines
652 B
JavaScript
22 lines
652 B
JavaScript
|
function drawChart(id,URL,opt) {
|
||
|
$.getJSON(URL).success(function (data) {
|
||
|
$(id).removeClass('loading');
|
||
|
|
||
|
// actually draw chart.
|
||
|
var gdata = new google.visualization.DataTable(data);
|
||
|
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));
|
||
|
|
||
|
chart.draw(gdata, opt);
|
||
|
|
||
|
|
||
|
}).fail(function() {
|
||
|
console.log('Could not load chart for URL ' + URL);
|
||
|
$(id).addClass('load-error');
|
||
|
|
||
|
});
|
||
|
}
|
||
|
|