Files
firefly-iii/public/assets/javascript/firefly/gcharts.js
2014-10-28 16:29:24 +01:00

26 lines
689 B
JavaScript

google.load('visualization', '1.0', {'packages': ['corechart']});
/*
If this method has not been defined (yet) it will error out.
*/
function googleLineChart(URL, container) {
$.getJSON(URL).success(function (data) {
/*
Get the data from the JSON
*/
gdata = new google.visualization.DataTable(data);
/*
Create a new google charts object.
*/
var chart = new google.visualization.LineChart(document.getElementById(container));
/*
Draw it:
*/
chart.draw(gdata, defaultLineChartOptions);
}).fail(function () {
$('#' + container).addClass('google-chart-error');
});
}