LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to overwrite xy graph data?

I have an xy graph visualizing data in every 30ms. I want to overwrite data for some time (controlled with a start/stop button) on the graph without appending incoming arrays. I know that it is possible with the picture plot, but is it also possible with the xy graph? Thanks
Ogulcan
0 Kudos
Message 1 of 13
(3,887 Views)
Set plot history to empty array?

soulsender wrote:
> I have an xy graph visualizing data in every 30ms. I want to overwrite
> data for some time (controlled with a start/stop button) on the graph
> without appending incoming arrays. I know that it is possible with the
> picture plot, but is it also possible with the xy graph? Thanks
> Ogulcan
0 Kudos
Message 2 of 13
(3,887 Views)
No actually I want the graph(xy graph not the picture control) to keep the old data too. But this should be without appending the incoming data.
0 Kudos
Message 3 of 13
(3,887 Views)
Use the 3-D graph for lines and set the projection to view head-on.
0 Kudos
Message 4 of 13
(3,887 Views)
> No actually I want the graph(xy graph not the picture control) to keep
> the old data too. But this should be without appending the incoming
> data.

Graphs erase and redraw each time data is written to their terminal.
There is an XY chart example that pushes the append in to a subVI and
allows you to easily control the amount of data retained.

I think you are looking for the graphics of the graph to be retained
without the original data, which is what the picture control is capable
of. Since this won't work with cursors, panning, or zooming, the XY
graph doesn't offer it as an option. If you combine the XY graph
picture control examples with the erase first option, you can get an XY
graph that does this in the picture with a minim
um of programming.

Greg McKaskle
0 Kudos
Message 5 of 13
(3,887 Views)
Seems like there is no way to do it -as I want it to be- with the xy graph. Thanks Greg...
0 Kudos
Message 6 of 13
(3,887 Views)

If I understand Ogulcan correctly, I am trying to do something very similar.  I want to draw lines numbered 1 to 250 in XY format and then "erase" line number 1 before I draw line 251, erase line 2 before drawing 252 and so on.  Erasing them all and starting over will not work because the operator will not see the full envelope of xy data as it changes over time.

 

In the past I have "erased" lines individually by redrawing them in the color of the background.  Perhaps one could set up a double buffering scheme with 2 plots so that at any particular time, one plot is drawing the new data line by line while the other plot is being redrawn line by line in the color of the background.

 

I've been working on a solution like this with the xy graph but now I'm wondering if drawing lines in a picture control as Greg suggested would prove easier.  The limits of my x and y data are fixed so there is no need to grow or autoscale the plot.  If I "grabbed" the image of the xy graph after the first 250 points were drawn, it would save me the trouble of creating numeric scales and tick marks in a picture manually.  Then I could overwrite (erase) and draw lines manually within that image going forward.  I would need to omit grid lines or devise some way of refreshing them.   I will have to look at the examples Greg suggested and go from there.  I welcome any comments or suggestions.

0 Kudos
Message 7 of 13
(2,453 Views)

@skinnedknuckles wrote:

If I understand Ogulcan correctly, I am trying to do something very similar.  I want to draw lines numbered 1 to 250 in XY format and then "erase" line number 1 before I draw line 251, erase line 2 before drawing 252 and so on.  Erasing them all and starting over will not work because the operator will not see the full envelope of xy data as it changes over time.


So what you really want is a XY Chart.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 13
(2,439 Views)

Is there a way to have the XY Chart erase line 1 before drawing line 251 and so on?  Can you direct me to an example?

0 Kudos
Message 9 of 13
(2,400 Views)

It turned out to be easier than I thought.  I used the complex number type (x + yi) because it allowed me to handle 2 dimensional data with1D arrays.  All I did was use the array builder as new data accumulated up to 250 samples.  I used the Build cluster array function to feed the array of clusters (1D in this case) to the XY graph.  After the complex array has reached 250 elements, instead of the array builder I switched to the Replace Array Subset function and replaced elements of the complex array as new data appeared.  I ended up with a 3-case State machine with the cases: BuildArray, OverwriteA and OverwriteB.  I only used a single plot but this method should work fine with multiple plots as well.  The random number generators simulate small variations in the data over time.  The attached code was created with an evaluation version of LabView.  I don't know if that will cause issues or not.

Download All
0 Kudos
Message 10 of 13
(2,257 Views)