FEATURE: add total on stacked-chart tooltip (#6917)

This commit is contained in:
Joffrey JAFFEUX 2019-01-22 09:57:34 +01:00 committed by GitHub
parent 4dee7ed6d9
commit b1b27d9f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -76,6 +76,13 @@ export default Ember.Component.extend({
mode: "index",
intersect: false,
callbacks: {
beforeFooter: tooltipItem => {
let total = 0;
tooltipItem.forEach(
item => (total += parseInt(item.yLabel || 0, 10))
);
return `= ${total}`;
},
title: tooltipItem =>
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL")
}