Display total in tooltip of stacked area chart #3493
adeel-usmani
started this conversation in
General
Replies: 2 comments
-
I've tried many things and I didn't find a solution to the same problem. I think the only way is to use a custom tooltip render function but I can't find a way to reuse the default tooltip render function either. If anyone has any hint on this, it would be very helpful! |
Beta Was this translation helpful? Give feedback.
0 replies
-
This isn't exactly what you were asking for, but it was good enough for me. You can customize the "x" text on the tooltip. It'll change it from 17 Feb to 17 Feb (Total: 91) tooltip: {
shared: true,
intersect: false,
x: {
formatter: function (
value,
{ series, seriesIndex, dataPointIndex, w }
) {
const series1Y = series[0][dataPointIndex] || 0;
const series2Y = series[1][dataPointIndex] || 0;
const stackedY = series1Y + series2Y;
return `${
data.dates[dataPointIndex]
} (Total: ${stackedY.toFixed(2)})`;
},
},
}, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there anyway I can get
total
number of data along with the data in the tooltip.Like in the given picture if I want to display the total in the tooltip as well (addition of all these 3 data points)
Beta Was this translation helpful? Give feedback.
All reactions