This commit is contained in:
Gwenhael Le Moine 2017-12-05 11:45:54 +01:00
parent a838613031
commit a3937f8e8a
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -20,6 +20,7 @@ app.component('dashboard',
.compact()
.flatten()
.value();
ctrl.retrieve_graph_values(ctrl.graphed_accounts);
};
@ -44,25 +45,23 @@ app.component('dashboard',
});
})
.each((cat) => {
cat = _(cat).sortBy((month) => {
return month.date;
});
cat = _(cat).sortBy((month) => { return month.date; });
});
ctrl.graphique = {
options: {
chart: {
type: 'multiBarChart',
height: 300,
height: 450,
stacked: true,
showControls: true,
showLegend: true,
showLabels: true,
showValues: true,
showYAxis: false,
showYAxis: true,
x: (d) => { return d.x; },
y: (d) => { return d.y; },
y: (d) => { return d.y ? d.y : 0; },
valueFormat: (d) => { return `${d}`; },
xAxis: {
@ -75,13 +74,6 @@ app.component('dashboard',
rotateLabels: -67,
labelSunbeamLayout: true,
useInteractiveGuideline: true,
multibar: {
dispatch: {
elementClick: function(event) {
ctrl.period = event.data.x; // FIXME: doesn't trigger data-binding
}
}
}
}
},
data: _.chain(response.data)
@ -90,7 +82,8 @@ app.component('dashboard',
.map((key) => {
return {
key: key,
values: _.chain(response.data[key]).map((value) => {
values: _.chain(response.data[key])
.map((value) => {
let date = new Date(value.date);
let period = date.getFullYear() + '-' + (date.getMonth() < 9 ? '0' : '') + (date.getMonth() + 1);
ctrl.periods.push(period);
@ -108,6 +101,8 @@ app.component('dashboard',
.value()
};
console.log(ctrl.graphique)
ctrl.periods = _.chain(ctrl.periods).uniq().sort().reverse().value();
ctrl.period = _(ctrl.periods).first();
});
@ -139,7 +134,7 @@ app.component('dashboard',
template: `
<div class="dashboard">
<div class="global-graph" style="height: 300px;">
<div class="global-graph" style="height: 450px;">
<div class="accounts" style="width: 20%; height: 100%; float: left;">
<ul>
<li ng:repeat="account in $ctrl.main_accounts_depths">