-
-
Couldn't load subscription status.
- Fork 1.4k
Description
Codesandbox
https://codesandbox.io/s/stacked-bar-chart-inverse-tooltip-order-bug-bm390
Explanation
This bug happens if you use the combination of stacked bar chart + tooltip.shared = true + tooltip.inverseOrder = true. And when you toggle some data set off and hover over the bar chart. I'll not show any data in the tooltip at all.
Not reverse tooltip (default)
tooltip.inverseOrder = true
From my digging, I found out that the problem lies in the function DOMhandling
from this function call, we pass t as the index of the label without inversing so in this case, the order of looping is inverse so it starts the loop from series-2 (disabled) then series-1.
apexcharts.js/src/modules/tooltip/Labels.js
Lines 119 to 134 in 0ee4c5e
| this.DOMHandling({ | |
| i, | |
| t, | |
| ttItems, | |
| values: { | |
| val, | |
| xVal, | |
| xAxisTTVal, | |
| zVal | |
| }, | |
| seriesName, | |
| shared, | |
| pColor | |
| }) | |
| } | |
| } |
then the function runs to here. It checks if it found collapsedSeriesIndices (contains 1 because non-inverse series-2 data is 1) containing the current index or not. We got the index of 1 with the series-1 data because the order is inverse. So it matches then it also set the display style to none
apexcharts.js/src/modules/tooltip/Labels.js
Lines 261 to 266 in 0ee4c5e
| if ( | |
| typeof val === 'undefined' || | |
| val === null || | |
| w.globals.collapsedSeriesIndices.indexOf(t) > -1 | |
| ) { | |
| ttItemsChildren[0].parentNode.style.display = 'none' |
-
What is the behavior you expect?
The tooltip should show the data that's not toggled off. -
What is happening instead?
The tooltip doesn't show any data at all. -
What error message are you getting?
no error message

