nteract / semiotic

A data visualization framework combining React & D3
https://semioticv1.nteract.io/
Other
2.44k stars 133 forks source link

Different tooltip behavior observed for bar chart with flattened vs. non flattened data #463

Closed dgwyer closed 5 years ago

dgwyer commented 5 years ago

For non-flattened data, the tooltip shows the data for all pieces on a stacked bar chart whereas when using flattened data the tooltip shows the data for each individual piece.

You can see this behavior here: https://codepen.io/dgwyer/pen/wZymaQ

Would it be possible to make the tooltips have consistent behavior? Or is it possible to get the same behavior for non-flattened data with a custom tooltip?

emeeks commented 5 years ago

Thanks for catching this, I'll get it fixed. You should not get different behavior in these two cases.

emeeks commented 5 years ago

Oh looking at it I thought you were reporting a different bug which is that the tooltip location seems to be different. I can't emit the same data in the two different cases because underneath the data is different. The piece hover only knows the data for the piece it's hovering over and wouldn't be able to tell you otherwise. However, you could use the column hover (hoverAnnotation) which has info for all of the pieces, along with a custom tooltip that accounts for the difference in structure, such as this: https://codepen.io/emeeks/pen/KYRjZJ

I will also make sure to fix the difference in the position of the tooltip.

dgwyer commented 5 years ago

I understand. Just wanted to flag this in case it wasn't the expected behavior.

And using the new rName property we can easily replicate the flattened data tooltip behavior using a custom solution.

https://codepen.io/dgwyer/pen/wZymaQ