mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 12:44:00 +08:00
FEATURE: add total on stacked-chart tooltip (#6917)
This commit is contained in:
parent
4dee7ed6d9
commit
b1b27d9f7b
|
@ -76,6 +76,13 @@ export default Ember.Component.extend({
|
||||||
mode: "index",
|
mode: "index",
|
||||||
intersect: false,
|
intersect: false,
|
||||||
callbacks: {
|
callbacks: {
|
||||||
|
beforeFooter: tooltipItem => {
|
||||||
|
let total = 0;
|
||||||
|
tooltipItem.forEach(
|
||||||
|
item => (total += parseInt(item.yLabel || 0, 10))
|
||||||
|
);
|
||||||
|
return `= ${total}`;
|
||||||
|
},
|
||||||
title: tooltipItem =>
|
title: tooltipItem =>
|
||||||
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL")
|
moment(tooltipItem[0].xLabel, "YYYY-MM-DD").format("LL")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user