1

Is there any way of showing what the current value of Y would be on an XYPlot?

I was previously using crosshairs (which shows the Y values at a common X) but I realized what I really needed was just to be able to display whatever the Y would be at the location of the mouse (not tied to any line data point). For example, if the Y axis goes from 10000 to 20000, and I put my mouse halfway up the chart, I’d want to receive the value 15000 in some handler or display it somehow.

Is it possible? I have looked at the documentation for _onNearestX and _onNearestY but it looks like those are tied to specific line series and not to the plot as a whole.

Alternatively, if I can't get the value of Y, being able to draw two intersecting lines where-ever I put the mouse would be helpful, but I can't find documentation on how to do that within the graph either.

Any help would be greatly appreciated.

CustardBun
  • 3,457
  • 8
  • 39
  • 65
  • 1
    I think you need to use `onMouseMove` on the `XYPlot`. Have you tried this? See [docs](https://github.com/uber/react-vis/blob/master/docs/xy-plot.md#onmousemove-optional) – technogeek1995 Feb 21 '20 at 16:18
  • @technogeek1995 Yes - I have, but could you explain how this is supposed to give me the value of Y? It triggers every time I move my mouse within the plot but doesn't provide any information about what the value of Y within the plot would be. – CustardBun Feb 21 '20 at 16:48

0 Answers0