firefly-iii/public/js/index.js
2015-03-07 12:34:03 +01:00

25 lines
741 B
JavaScript

google.setOnLoadCallback(drawChart);
function drawChart() {
googleLineChart('chart/home/account', 'accounts-chart');
googleBarChart('chart/home/budgets', 'budgets-chart');
googleColumnChart('chart/home/categories', 'categories-chart');
googlePieChart('chart/home/bills', 'bills-chart');
getBoxAmounts();
}
function getBoxAmounts() {
var boxes = ['in', 'out','bills-unpaid','bills-paid'];
for (x in boxes) {
var box = boxes[x];
$.getJSON('/json/box', {box: box}).success(function (data) {
if(data.amount_raw != 0) {
$('#box-' + data.box).html(data.amount);
}
}).fail(function () {
console.log('Failed to get box!')
});
}
}