LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

plot

I am using  "PlotWaveform" to display trace from spectrum analyzer periodically (using timer). I added Marker using "PlotPoint" function.

 

Before displaying updated trace I clear graph area using :

DeleteGraphPlot (gAnalyzerPanelHandle, SAPANEL_SA_GRAPH, plotSaHandle,VAL_IMMEDIATE_DRAW);

 

But this function does not delete my marker created with "PlotPoint". Which function should I use to delte my marker before displaying updated version?

 

Maybe somebody knows good example of implementing spectrum analyzer control?

 

Leszek

 

 

plotSaHandle = PlotWaveform (gAnalyzerPanelHandle, SAPANEL_SA_GRAPH, amplitude, return_samples-1, VAL_DOUBLE, 1.0, 0.0, 0.0, 1,
          VAL_THIN_LINE, VAL_SIMPLE_DOT, VAL_SOLID, 1, VAL_YELLOW);

    
    PlotPoint (gAnalyzerPanelHandle, SAPANEL_SA_GRAPH, xCoordinate, yCoordinate, VAL_SOLID_DIAMOND, VAL_WHITE);

 

0 Kudos
Message 1 of 5
(4,120 Views)

If you want to delete ALL plots from the graph you must pass -1 instead of plotSaHandle in plot handle parameter of DeleteGraphPlot.

On the other side, if you simply want to remove ALSO the point leaving other plots untouched, you mast previously save the point plot handle and specifically delete it:

 

when plotting:

pointHandle = PlotPoint (gAnalyzerPanelHandle, SAPANEL_SA_GRAPH, xCoordinate, yCoordinate, VAL_SOLID_DIAMOND, VAL_WHITE);

 

when deleting:

DeleteGraphPlot (gAnalyzerPanelHandle, SAPANEL_SA_GRAPH, pointHandle, VAL_IMMEDIATE_DRAW);

 



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?
0 Kudos
Message 2 of 5
(4,117 Views)

Ciao!

 

Grazie molto!

 

I will try tomorrow morning.

 

Arrivederci!

0 Kudos
Message 3 of 5
(4,114 Views)

Hello Leszek,

 

Roberto has already answered your question about the plot handles, but I wanted to also chime in about the last parameter that you're passing to the DeleteGraphPlot function. You're passing VAL_IMMEDIATE_DRAW which causes the graph to refresh its plot area immediately after removing the plot(s). However, you also mentioned that the reason you're deleting the graph is because you want to update the data, i.e., you want to plot more data shortly thereafter.

 

If that's the case, then I recommend that you pass VAL_DELAYED_DRAW instead of VAL_IMMEDIATE_DRAW. By doing so, the graph will only redraw after you plot the new data. Therefore, what you see in the graph is your previous plots replaced by your new plots without the background flashing in between. It might not be a big deal if you update the graph infrequently, but if not, it makes the update a lot smoother, and also a bit faster.

 

Luis

Message 4 of 5
(4,089 Views)

Luis and Roberto,

 

Thank you very much for your help. I am rather beginner, working few months on this project and rather part time. I am trying to create user interface to test RF devices using signal generator, PSA, power meter, RF switches etc.

 

Your hints were very usefull. My virtual spectrum analyzer now looks like real! I can experiment with sampling rate to make it even more realistics ( I read trace every 500ms, which is probably enough). I use PlotPoint (gAnalyzerPanelHandle, SAPANEL_SA_GRAPH, xCoordinate, yCoordinate, VAL_SOLID_DIAMOND, VAL_WHITE) to implement Marker, but it looks kind of small.  Probably the only way to cerate bigger marker would be by using either PlotRectangle (, , , , , , VAL_RED, VAL_RED) or PlotOval (, , , , , , VAL_RED, VAL_RED) , so I could make it bigger.

 

Leszek

0 Kudos
Message 5 of 5
(4,070 Views)