victory icon indicating copy to clipboard operation
victory copied to clipboard

Implement victory-tooltip

Open coopy opened this issue 11 years ago • 27 comments

Requirements:

  • similar to label in that tooltips get positioned by their parents and are provided with data
  • should be positioned above other components (react-gateway? react-portal?)
  • should have some automatic events like hover
  • Integration into parents should be flexible i.e. should be able to pass custom tooltip components.

coopy avatar Dec 03 '15 00:12 coopy

+1

thochi avatar Jan 18 '16 13:01 thochi

+1

joanllenas avatar Feb 01 '16 16:02 joanllenas

If we're going to be rendering the tooltip outside of the svg context, react-gateway may be of interest.

coopy avatar Feb 08 '16 00:02 coopy

:+1: Would love to see this.

hourliert avatar Feb 10 '16 00:02 hourliert

Hi, I think it could be helpful to have a callback function like onMouseHoverData={({mouseX, mouseY, values=[...]}) => {...}} as a low level api, so we can implement some custom tooltips.

azazdeaz avatar Feb 22 '16 16:02 azazdeaz

is there any work being done with this?

luisrudge avatar Feb 22 '16 19:02 luisrudge

@luisrudge yes. There is work going on in victory to support event handling generally, and @dandelany I believe is working on a specific tooltip component.

boygirl avatar Feb 23 '16 19:02 boygirl

:+1: Only thing holding me back from using Victory right now :)

mariussoutier avatar Feb 26 '16 10:02 mariussoutier

Awesooooooome. Thanks everyone.

luisrudge avatar Feb 26 '16 15:02 luisrudge

Requirements:

  • similar to label in that tooltips get positioned by their parents and are provided with data
  • should be positioned above other components (react-gateway? react-portal?)
  • should have some automatic events like hover
  • Integration into parents should be flexible i.e. should be able to pass custom tooltip components.

boygirl avatar Mar 01 '16 18:03 boygirl

:+1:

rbvea avatar Mar 01 '16 19:03 rbvea

@dandelany has kindly shared some of his tooltip implementations that we might reference.

https://gist.github.com/dandelany/bd2fc7d9af96d50b53dd

https://github.com/dandelany/vector-toy/blob/master/src/components/SimpleTooltip.jsx

https://github.com/dandelany/vector-toy/blob/master/src/components/TippedComponent.jsx

boygirl avatar Mar 02 '16 02:03 boygirl

Agree with others about passing a custom component for tooltip being nice.

Would also be nice if tooltip had an optional "crosshairs" attribute for adding a line on x and/or y axis that would point to hovered data point from the axis. If this is outside scope, maybe a separate victory component for this.

shantp avatar Apr 05 '16 20:04 shantp

The folks at recharts done this already, maybe worth iterating on their work or getting some ideas, see: https://github.com/recharts/recharts/blob/master/src/component/Tooltip.js

seems to work pretty well.

knowbody avatar Apr 06 '16 15:04 knowbody

Any updates on this? :)

syrusakbary avatar Apr 19 '16 02:04 syrusakbary

This will be in the next release!

boygirl avatar Apr 19 '16 02:04 boygirl

👍

thedrew12 avatar May 26 '16 21:05 thedrew12

This is getting pushed back on more release (mid June). Sorry everyone! This release (today) will have support for controlling events between Victory Components, so the pieces are all in place for a flexible tooltip implementation. For a quick fix, you should be able to create tooltips scoped to a single Victory Component with the current event system and custom label components.

boygirl avatar Jun 01 '16 18:06 boygirl

Thanks for the update @boygirl. I've been using Victory but tooltips are not very easy to implement as of how the code is structured (or was structured). Could you provide a simple example implementation for having tooltips scoped to a Victory component?

syrusakbary avatar Jun 02 '16 01:06 syrusakbary

@syrusakbary so long as you don't also need labels you can pass in a custom labelComponent and trigger events as you would on label. I'll get some examples up next week.

boygirl avatar Jun 02 '16 02:06 boygirl