K Waris Posted September 17, 2013 Report Share Posted September 17, 2013 I wonder if it is possible that I could trigger an event when one of the plot on the waveform chart/waveform graph is clicked when the cursor of the mouse is hovered over the plot and the left key of the mouse is pressed down?? Any ideas? Best Regards K Waris Quote Link to comment
hooovahh Posted September 17, 2013 Report Share Posted September 17, 2013 (edited) 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 September 17, 2013 by hooovahh Quote Link to comment
K Waris Posted September 17, 2013 Author Report Share Posted September 17, 2013 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 Could we determine the x and y coordinates of points where the mouse is clicked? Best Regards K Waris Quote Link to comment
Austin Lee Posted September 17, 2013 Report Share Posted September 17, 2013 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 Quote Link to comment
Austin Lee Posted September 17, 2013 Report Share Posted September 17, 2013 Hoovahs method is much more efficient then the way I suggested. I did some very rough calculations and added in a boolean control that moves to the approximate click position (you could make a more exact calculation and replace it with a cursor image. Graph Mouse Click Plot with Cursor.vi Quote Link to comment
K Waris Posted September 17, 2013 Author Report Share Posted September 17, 2013 Vow That's amazing Thanks Quote Link to comment
Darin Posted September 17, 2013 Report Share Posted September 17, 2013 You guys really need to discover the GetPlotAtPos method of the Graph/Waveform. Where is the LAVA Rube thread? 1 Quote Link to comment
hooovahh Posted September 17, 2013 Report Share Posted September 17, 2013 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.