Jump to content

Generate Event by clicking a plot on waveform chart/graph


K Waris

Recommended Posts

I'm not sure I fully understand what you need.  Your post was a little wordy.  But I think what you want is the "Mouse Down" event on the graph.  This will be generated when a mouse click event happens when the mouse is on the graph.  You can then read the "Button" value and determine which mouse button was used (left, right, middle).  You can then determine if the mouse is on a specific part of the graph and ignore the event or not based on other criteria.

 

EDIT:

 

Okay so I re-read you post and I think you want to know when a plot is clicked on.  Attached is a quick example on how you might be able to do it.  Run it and click on a data point on the white plot and it should stop and tell you what you clicked on.  Note that this only works on the points them selves, and not the line drawn between them but you can modify it to support that.  Also note that if you are within 5% of a point it considers you clicking that point, for some large or small graphs this may need to be changed.

Graph Mouse Click Plot.vi

Edited by hooovahh
Link to comment

Hi Hoovah Thanks for your reply

 

I want to add a cursor wherever I click on a waveform chart/graph. The specifications are stringent!!

  • there could be more than 1 plots on a graph, so for a given x value there could be upto four y (plot) values. when one of the plot at that x value is clicked, the cursor is added programatically locked to that plot. 

In your reply ' You can then determine if the mouse is on a specific part of the graph and ignore the event or not based on other criteria.You can then determine if the mouse is on a specific part of the graph and ignore the event or not based on other criteria'

 

if I can determine the x and y coordinates of a point 'on waveform chart/graph' where the mouse (left key in my case) is clicked, then I can compare these values with the values of the plot arrays and then lock the cursor to the right array :thumbup1:

Could we determine the x and y coordinates of points where the mouse is clicked?

 

Best Regards

K Waris

Link to comment

You could use a method like this to obtain the pixel color of the location that you clicked. You could trigger an event based on the color of the location you clicked. (ie determine which plot aspect you clicked on based on its color).

 

 

Your trying to develop a chart with something similar to the trace plot  functionality that TI graphing calculators have correct?

Method.vi

Link to comment
You guys really need to discover the GetPlotAtPos method of the Graph/Waveform.  Where is the LAVA Rube thread?

Well we probably do need one.  In my defense I could control how close to a point you could be.  I noticed that the GetPlotAtPos method registers when you are clicking on the line.  I increased the line width and my space I could click increased.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.