LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how can I add 1 point at a time to a graph

how can I add 1 point at a time to a graph control?  I want to have two curves on this graph and update one point at a time on one curve, then the next point on the other curve?, then one more to the first, etc.    CVI 8.1
thanks
0 Kudos
Message 1 of 8
(5,049 Views)
If the update frequency is low, you can remember the old point coordinates in some variables and add the new point with PlotLine.


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 8
(5,041 Views)
If you are interested in displaying only the most recent data handled, and minimal user interaction is required, you could consider using a Strip Chart control. It is very simple to add a single point to each trace, using PlotStripChart() or PlotStripChartPoint().

If you use a graph control, you will need to ensure that the control's plot data cannot grow without limit. See the Help for ATTR_DATA_MODE.

Regards,
Colin.
0 Kudos
Message 3 of 8
(5,031 Views)

thanks for your suggestions.  I ended up using plotpoint and 2 different colors which seems to be a reasonable solution for now.  But would someone please remind me how to put two curves on an XY plot.  I can't find it anywhere in the help files, and the examples don't use two curves.  I think it has something to do with arrays, but I don't remember the specifics.

Thanks for your help

 

0 Kudos
Message 4 of 8
(4,998 Views)

You can add as many plots you want on a graph simply issuing the appropriate PlotXXXXX command. In effect, when you add your points to the graph with PlotPoint you are adding a plot on the grah, which you could individually address to customize or delete if you save the plot handle returned by the function.

In case you have a series of X and Y data you can use PlotXY passing it your arrays and the number of points to plot, and again you can use PlotXY several time to plot different diagrams on your graph.



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 5 of 8
(4,995 Views)
got it, thanks
0 Kudos
Message 6 of 8
(4,990 Views)
If I have 2 traces and I want to add a point in the first of them... I have the plotHandle, how can I do it?

0 Kudos
Message 7 of 8
(4,746 Views)

There is no way to add a point to an existing plot to a graph the same as you do on a strip chart. What you need to do is to delete the existing plot and redraw a new one with the new data. if your acquisition is slow and you do not want to keep global arrays for your data you can retrieve plot data from the graph itself with ATTR_PLOT_XDATA and ATTR_PLOT_YDATA attributes of GetPlotAttribute, next extend the arrays, add new points and redraw the plot.

Howver, this question seems strictly related to this thread so you can look at Luis suggestions on that argument.



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 8 of 8
(4,728 Views)