red/green total in tooltip

This commit is contained in:
Gwenhael Le Moine 2018-05-19 10:54:11 +02:00
parent 08861e44bc
commit bbbc714f68
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
3 changed files with 15 additions and 13 deletions

View file

@ -14,7 +14,7 @@ pull-deps:
cd public/vendor; npm install cd public/vendor; npm install
clean: clean:
-rm public/js/app.min.js public/js/app.js -rm public/js/app.min.js public/js/app.js credger
clean-all: clean-all:
-rm -fr lib/ public/vendor/node_modules -rm -fr lib/ public/vendor/node_modules

View file

@ -94,19 +94,21 @@ app.component('dashboard',
return series.filter((s) => { return s.value != 0; }); return series.filter((s) => { return s.value != 0; });
}; };
return ` let total = e.series.reduce((memo, serie) => { return memo + serie.value; }, 0);
return `
<h2>${e.value}</h2> <h2>${e.value}</h2>
<table> <table>
<tbody> <tbody>
${prepare_series(e.series).map((s) => { return format_line(s); }).join("")} ${prepare_series(e.series).map((s) => { return format_line(s); }).join("")}
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr style="color: #ececec; background-color: ${total < 0 ? 'green' : 'red'}">
<td> </td> <td> </td>
<td style="text-align: right; text-decoration: underline; font-weight: bold;">Total</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> <td style="text-align: right; font-weight: bold;">${total}</td>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
`; `;
} }

View file

@ -2,7 +2,7 @@ version: 1.0
shards: shards:
kemal: kemal:
github: kemalcr/kemal github: kemalcr/kemal
commit: 8cb9770ec3c6cf5897e644229dad8d0b5c360941 commit: 50f82f51874babe92cbb808013647a7989d54354
kilt: kilt:
github: jeromegn/kilt github: jeromegn/kilt