01-17-2017 02:57 PM
Hi everyone,
In my program, I have a chart which can have up to 40 plots on it. I have a feeling this isn't a feature, but a colleague of mine asked if it is, so I thought I would ask anyway. Is it possible to hover the mouse over one of the plots on the chart and have it tell you what plot it is? I have a legend for the chart, but with up to 40 plots, it can be difficult to read.
Thanks!
Solved! Go to Solution.
01-17-2017 03:47 PM - edited 01-17-2017 03:54 PM
We don't get that function, but this might help.
Right Click on your Plot Legend and select Visible Items, then turn on the Plot Visibility Checkbox.
This will allow you to turn plots on and off to clean things up a bit.
01-17-2017 03:53 PM
You can use cursors to do this. There is an XYGraph.Cursor.Plot property node. Note however that I have never had good luck with cursors... they often exhibit unexpected behavior.
Basically you will trigger on the XY Graph "Mouse Down?" event. Look at the coords, call the "Map Coords to XY" invoke node. then set the XYGraph.Cursor.PosX to the X click. It should snap to the nearest plot and then the XYGraph.Cursor.Plot will tell you which one the click was closest to. (You could of course do this with the Mouse Move event to get a constant udpate and have hidden cursrors).
01-17-2017 04:09 PM
Here is some sample code
01-17-2017 04:10 PM
Cursors don't work on charts, AFAIK. The OPs post was for charts.
01-17-2017 04:13 PM
@aputman wrote:
Cursors don't work on charts, AFAIK. The OPs post was for charts.
Oops! I missed that he wanted it on a chart. Thanks:)
I have done an XYGraph with a circular buffer before so it behaved like a waveform chart but that gets cumbersome.
01-19-2017 02:16 PM - edited 01-19-2017 02:24 PM
Is it possible to hover the mouse over one of the plots on the chart and have it tell you what plot it is?
Yes
The above may be a start.
It is messy but ssems to work.
Ben
01-20-2017 07:42 AM
Hmmm...
Nobody wanted to call me out on using the X value as the sample array index huh?
(smiley-wink)
Ben
01-20-2017 08:22 AM
@Ben wrote:
Hmmm...
Nobody wanted to call me out on using the X value as the sample array index huh?
(smiley-wink)
Ben
I wanted to... until I ran your snippet to see what you were doing 🙂 Clever solution.
01-20-2017 08:46 AM - edited 01-20-2017 08:46 AM
Well, I thought about a similar solution but what happens if you have two plots in the same location? I couldn't think of a way to handle that so I didn't even try.
Maybe your solution does handle it??? Nice job.