From b1b27d9f7b69baaa76ef8fd949797d73e6e447ae Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 22 Jan 2019 09:57:34 +0100 Subject: [PATCH] FEATURE: add total on stacked-chart tooltip (#6917) --- .../admin/components/admin-report-stacked-chart.js.es6 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 index fc9d7dac741..9b9d27e81fc 100644 --- a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 +++ b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 @@ -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") }