diff --git a/public/ts/components/dashboard.ts b/public/ts/components/dashboard.ts
index 555586f..95af8bb 100644
--- a/public/ts/components/dashboard.ts
+++ b/public/ts/components/dashboard.ts
@@ -59,21 +59,46 @@ app.component('dashboard',
showLabels: true,
showValues: true,
showYAxis: true,
-
- x: (d) => { return d.x; },
- y: (d) => { return d.y ? d.y : 0; },
- valueFormat: (d) => { return `${d} €`; },
-
- xAxis: {
- tickFormat: (d) => {
- return `${d}${d == ctrl.period ? '*' : ''}`;
- }
- },
duration: 500,
reduceXTicks: false,
rotateLabels: -67,
labelSunbeamLayout: true,
useInteractiveGuideline: true,
+ interactiveLayer: {
+ dispatch: {
+ elementClick: (t) => {
+ console.log(ctrl.period)
+ ctrl.period = t.pointXValue;
+ console.log(ctrl.period)
+ }
+ },
+ tooltip: {
+ contentGenerator: function(e) {
+ let format_line = (serie) => {
+ return `
+
+ |
+${serie.key} |
+${serie.value} |
+
+`;
+ };
+
+ let prepare_series = (series) => {
+ series.sort((s1, s2) => { return s2.value - s1.value; });
+
+ return series.filter((s) => { return s.value != 0; });
+ };
+
+ return `
+${e.value}
+
+${prepare_series(e.series).map((s) => { return format_line(s); }).join("")}
+
+`;
+ }
+ }
+ }
}
},
data: _.chain(response.data)
@@ -101,8 +126,6 @@ app.component('dashboard',
.value()
};
- console.log(ctrl.graphique)
-
ctrl.periods = _.chain(ctrl.periods).uniq().sort().reverse().value();
ctrl.period = _(ctrl.periods).first();
});
@@ -118,7 +141,7 @@ app.component('dashboard',
.map((account) => {
return {
name: account[0],
- depth: _(['Expenses', 'Income']).contains(account[0]) ? 1 : 0,
+ depth: _(['Expenses']).contains(account[0]) ? 2 : _(['Income']).contains(account[0]) ? 1 : 0,
max_depth: _.chain(ctrl.raw_accounts)
.select((account2) => { return account2[0] == account[0] })
.reduce((memo, account3) => { return account3.length > memo ? account3.length : memo; }, 0)
@@ -133,35 +156,29 @@ app.component('dashboard',
],
template: `
-
-
-
-
--
-
-
-
-
-
-
-
-
-
-
-
-
- {{$ctrl.period}}
-
+
+
+
+
+ -
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
`
});