You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to emulate the functionality provided by Excel and echarts has no native support for 100% stacked charts.
I have tried to work around this by calculating the percentages myself but then you lose the original value tooltip.
The advised way to do so is to calculate percentage as you said. The tooltip can set formatter or valueFormatter to calculate the original value. If you or anyone from the Apache Superset community wish to implement this in Apache ECharts, we would appreciate it very much. Maybe an option like stackPercent: true should be added.
Hi @Ovilia, I tried implementing the tooltip in valueFormatter but I'm not given the params object (which is available a few levels up the call stack) so the only information I know is the percentage value. If I use the tooltip formatter instead then I lose the nice default tooltip containing the series colour and other information. Thanks for your help :)
Hi, I have looked at the two examples and these do work around part of the problem, but not fully.
By transforming the incoming data in to percentages we can no longer get access to the original values.
The result is that the tooltip can only show the percentage value, see below.
So the problem remains: I want to plot 100% stacked while keeping the source data as the original value?
Reacted by 108EAA0A, jaaakesmyth, Rob, Sergio Ropero, kadakia-sesame and Steven Cobb
Hi, I have looked at the two examples and these do work around part of the problem, but not fully. By transforming the incoming data in to percentages we can no longer get access to the original values. The result is that the tooltip can only show the percentage value, see below. So the problem remains: I want to plot 100% stacked while keeping the source data as the original value?
I've opened a PR #20910 to address this by adding stackPercent: boolean, which will show the original value and normalized value (as a percent of the total stack) in the tooltip:
Activity
Ovilia commentedon Jun 8, 2022
The advised way to do so is to calculate percentage as you said. The tooltip can set
formatterorvalueFormatterto calculate the original value. If you or anyone from the Apache Superset community wish to implement this in Apache ECharts, we would appreciate it very much. Maybe an option likestackPercent: trueshould be added.Shaq76 commentedon Jun 8, 2022
Hi @Ovilia, I tried implementing the tooltip in valueFormatter but I'm not given the params object (which is available a few levels up the call stack) so the only information I know is the percentage value. If I use the tooltip formatter instead then I lose the nice default tooltip containing the series colour and other information. Thanks for your help :)
Ovilia commentedon Jun 8, 2022
You should probably save the sum to a variable that can be accessed by
valueFormatter.Shaq76 commentedon Jun 21, 2022
Just a note that this looks similar in implementation to the following PR:
#17086
Creatium commentedon Nov 7, 2022
Hi. Any updates on this? I still see no way to make bar charts stack to 100% easily, without hacking with 0.X values.
LeoDiep commentedon Sep 8, 2023
Hi. is this still updated
108EAA0A commentedon Feb 22, 2024
+1, Please implement this
Ovilia commentedon Feb 26, 2024
Please checkout https://echarts.apache.org/examples/zh/editor.html?c=bar-stack-normalization and https://echarts.apache.org/examples/zh/editor.html?c=bar-stack-normalization-and-variation
Shaq76 commentedon Feb 26, 2024
Hi, I have looked at the two examples and these do work around part of the problem, but not fully.

By transforming the incoming data in to percentages we can no longer get access to the original values.
The result is that the tooltip can only show the percentage value, see below.
So the problem remains: I want to plot 100% stacked while keeping the source data as the original value?
sjcobb commentedon Apr 10, 2025
I've opened a PR #20910 to address this by adding
stackPercent: boolean, which will show the original value and normalized value (as a percent of the total stack) in the tooltip: