victory icon indicating copy to clipboard operation
victory copied to clipboard

VictoryBoxPlot does not show label tooltips

Open harrisonlo opened this issue 2 years ago • 8 comments

Describe the bug The labelComponent prop does not seem to have an effect on VictoryBoxPlot, unlike the pattern in other charts such as VictoryPie or VictoryBar. Passing VictoryTooltip in would not show a tooltip on hover.

Victory version 36.6.10

Code Sandbox link https://codesandbox.io/s/victory-boxplot-tooltip-issue-33tmtt

To Reproduce Steps to reproduce the behavior:

  1. Open sandbox
  2. Hover around VictoryBoxPlot
  3. Hover around VictoryBar to see tooltips

Expected behavior VictoryBoxPlot with a VictoryTooltip component in the labelComponent prop would show a tooltip on hover

harrisonlo avatar Jun 16 '23 01:06 harrisonlo

I'm having a lot of difficulty with this too. Does anyone have a workaround, or is there any update?

troynguyen8 avatar Feb 20 '24 21:02 troynguyen8

The VictoryBoxPlot does not have a labelComponent property, but instead has specific labels depending on the type of data you want to display. These additional label properties do not yet support the Tooltip, only labelComponent currently does.

API Reference: https://commerce.nearform.com/open-source/victory/docs/victory-box-plot

carbonrobot avatar Feb 22 '24 19:02 carbonrobot

Hi there @harrisonlo and @troynguyen8 . I'm currently researching this issue. Appreciate the reproduction example. After reviewing the code, I can definitely say Victory does not currently support usage of labelComponent within VictoryBoxPlot. It appears this was intentional because boxPlots use different data structures than our other charts. Things such as median, min and max which don't currently work with VictoryTooltip.

Do you mind sharing a bit more about your use case here? We do provide specific labelComponents for max, median, and min labelcomponents (Ex: here) which do work as labels, but not as tooltips.

I will have to discuss with the team, but it seems to keep this specific BoxPlot api working, it might be preferable to add support for tooltips in each of those labelComponents, rather than adding a new generic labelComponent. Would that work for you?

If you could provide more about what type of tooltip behavior you want to see that would be helpful, as there are many values associated with each of the box plots.

Finally, I realize the documentation for common props makes it appear that all components support labelComponent, so that's our bad. I will make a note to update the documentation so that point is clearer.

Burnett2k avatar Feb 22 '24 23:02 Burnett2k

Hey @Burnett2k !

it might be preferable to add support for tooltips in each of those labelComponents, rather than adding a new generic labelComponent. Would that work for you?

This would work well for my use case! I'm essentially hoping for a press (I'm using Victory Native) on anywhere in the boxplot to show the stats in detail view. Within the tooltip could be something like

Full qualitative X axis name
min: 0
q1: 10
median: 15
q3: 20
max: 25

In an ideal world this tooltip would always point toward the median of the boxplot, but it would not be a deal breaker if I had to pass tooltip to each of the 5 stats and they'd point to the whisker/box lines all with the same content

troynguyen8 avatar Feb 22 '24 23:02 troynguyen8

I was really expecting that at a minimum, supplying the tooltip to the specific labels:

maxLabelComponent={<VictoryTooltip />}

would work, but it doesn't 😥. My boxplots look a bit busy with all the labels, I think my users expect to hover for values, just like stacked bar charts or anything else:

Screenshot 2024-05-28 at 4 34 43 PM

Is there any way to work around this at the moment?

chriszrc avatar May 28 '24 19:05 chriszrc

@chriszrc Agreed, I think I was surprised its not supported as well! I have it up at the top of our features list, but currently no one available to tackle it. I don't have any easy workarounds atm, unfortunately.

carbonrobot avatar Jun 03 '24 20:06 carbonrobot