LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to delete a plot with using mouse to select it on the graph control?

Solved!
Go to solution

For example, when I use PlotLine to plot thousands of lines on the graph control, I want to delete some of them, but there is thousands of plotHandle generated.

How can I get the plotHandle of the specific line on the graph control with using mouse to select it?

 

If I record information of the lines, ex. the plotHandle and the coordinates, on a table or list, etc. , I have to compare the information of lines to get the plotHandle of the specific line.
Is there any user-friendly way to delete a plot by select it on the graph control?

0 Kudos
Message 1 of 5
(3,852 Views)

Sure! Look at the example located in \samples\userint\graphcursors for an example of how to accomplish this task.

 

Briefly:

  • The cursor must be in "Snap to point" mode
  • (To be confirmed) The graph must be in "Retain" data mode
  • You must have a callback for the graph control
  • You can use GetGraphCursorIndex to retrieve the plot handle
  • GetGrpahCursor retrieves values of cursor position in engineering units


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(3,847 Views)

Dear Roberto,

Thanks for your reply.

 

I have tried the method you mentioned, but I can't have lines plotted by PlotLine deleted by using this method.

 

Since the cursor only snaps to the closest point, polygon, waveform, X, XY , or Y plot, when I use GetGraphCursorIndex to get the plotHandle of a certain line plotted by PlotLine, the returned plotHandle is always -1. That means the cursor is not attached to the line plot I want to delete. Hence, I can't delete the line plot by using DeleteGraphPlot.

 

The method I have already known to delete all kinds of plots is example graphlegend, but after thousands of line plots are generated by PlotLine on the graph control, it is troublesome to select the correct plotHandle of the line plot from the list.

 

To be brief, how should I do to get the plotHandle of the line plot generated by PlotLine by using mouse to select the line plot on the graph control?

0 Kudos
Message 3 of 5
(3,825 Views)
Solution
Accepted by topic author SimuelDan

I can't give you a reasonable way to solve this problem since as you already have noted PlotLine do not produce snappable plots.

A feasible warkaround could be to replace individual PlotLine instructions with a corresponding PlotXY with 2 arrays of 2 points each, which correspond to x1, x2, y1, y2 parameters of PlotLine. PlotXY plots are snappable so you can enable that procedure to select the plot and delete it.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 4 of 5
(3,810 Views)

Thanks a lot.

Your suggestions do me a great favor.

Now I know how to delete a specific line plot.

0 Kudos
Message 5 of 5
(3,792 Views)