mirror of
https://github.com/gwenhael-le-moine/credger.git
synced 2024-12-26 09:58:36 +01:00
total in global graph tooltip
This commit is contained in:
parent
9a16fa1069
commit
923957aab4
1 changed files with 17 additions and 8 deletions
|
@ -75,12 +75,12 @@ app.component('dashboard',
|
||||||
tooltip: {
|
tooltip: {
|
||||||
contentGenerator: function(e) {
|
contentGenerator: function(e) {
|
||||||
let format_line = (serie) => {
|
let format_line = (serie) => {
|
||||||
return `
|
return `
|
||||||
<tr>
|
<tr>
|
||||||
<td style="background-color: ${serie.color}"> </td>
|
<td style="background-color: ${serie.color}"> </td>
|
||||||
<td>${serie.key}</td>
|
<td>${serie.key}</td>
|
||||||
<td style="text-align: right; font-weight: bold;">${serie.value}</td>
|
<td style="text-align: right; font-weight: bold;">${serie.value}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,10 +90,19 @@ app.component('dashboard',
|
||||||
return series.filter((s) => { return s.value != 0; });
|
return series.filter((s) => { return s.value != 0; });
|
||||||
};
|
};
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<h2>${e.value}</h2>
|
<h2>${e.value}</h2>
|
||||||
<table>
|
<table>
|
||||||
${prepare_series(e.series).map((s) => { return format_line(s); }).join("")}
|
<tbody>
|
||||||
|
${prepare_series(e.series).map((s) => { return format_line(s); }).join("")}
|
||||||
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
<td style="text-align: right; text-decoration: underline; font-weight: bold;">Total</td>
|
||||||
|
<td style="text-align: right; font-weight: bold;">${e.series.reduce((memo, serie) => { return memo + serie.value; }, 0)}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue