total in global graph tooltip

This commit is contained in:
Gwenhael Le Moine 2017-12-15 19:38:48 +01:00
parent 9a16fa1069
commit 923957aab4
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -76,11 +76,11 @@ app.component('dashboard',
contentGenerator: function(e) {
let format_line = (serie) => {
return `
<tr>
<td style="background-color: ${serie.color}"> </td>
<td>${serie.key}</td>
<td style="text-align: right; font-weight: bold;">${serie.value}</td>
</tr>
<tr>
<td style="background-color: ${serie.color}"> </td>
<td>${serie.key}</td>
<td style="text-align: right; font-weight: bold;">${serie.value}</td>
</tr>
`;
};
@ -90,10 +90,19 @@ app.component('dashboard',
return series.filter((s) => { return s.value != 0; });
};
return `
return `
<h2>${e.value}</h2>
<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>
`;
}