Skip to content

Tooltip hide non-collapsed data mistakenly when using stacked barchart with shared + inverseOrder tooltip #1133

@WiNloSt

Description

@WiNloSt

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)

Screen Shot 2562-12-13 at 01 48 21

tooltip.inverseOrder = true

Screen Shot 2562-12-13 at 18 49 12

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.

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions