LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding cursors to a chart, or making a graph auto scroll and clear old data

I need to display my collected data over time. I want to display this in 5min chunks on the graph. Using a chart is the best option since the data is not stored in an endless array perpetually slowing my program down so I can set the chart history length to my 5 minutes of data and be fine. The problem is I have to have the graph display cursors as markers for the data which I can only do on a graph. this means that my data is stored continously in an array which almost always slows the program down after 1-2hrs of running. Is there anything I can about this? Why is there no way to add cursors to charts?

 

 

0 Kudos
Message 1 of 6
(3,539 Views)
Do not create memory leak. Setup an array which has the size you need, and do not increase its size beyond your specified max. And use a graph so you can have cursors.
0 Kudos
Message 2 of 6
(3,520 Views)

How do I set the array size? I have time on the x axis of my graph will the x axis still scroll forward if there is no data behind that firs data point?

 

Edit: So what I have tried is simply placing an array subset before my grpah and setting the index to be once block of time (in my case 5min of data), this seems to be working, was this a best approach?

 

Edit 2: actually it does not work. it does display only 300 samples(5min of data 1pt/sec) but the graph does not update beyond 300 now. it just erases data as it moves forward in time.

0 Kudos
Message 3 of 6
(3,513 Views)
Use shift register. I cannot send you an example, i do not have labview now. There are different ways to do this and should be simple. Why dont you google, there are many examples, like these:
https://decibel.ni.com/content/docs/DOC-8642
http://forums.ni.com/t5/LabVIEW/Master-Slave-3-dependent-loops/m-p/631892?view=by_date_ascending#M29...
0 Kudos
Message 4 of 6
(3,485 Views)

It sounds like you have a fundamental misunderstanding of graphs and charts.  Here's something to look over: http://digital.ni.com/public.nsf/allkb/95FEE9F5B252507E862562BA00007657

 

Graphs do NOT build up an array indefinitely.  YOU build up arrays indefinitely. Graphs will graph the entire array you input.  If you continue to buid it indefinitely, this will happen.  There are plenty of ways to work with this.  It sounds like you're wanting to show five minutes of data at a time, not just giving that time as an example.  It's not complicated to do this.  Off the top of my head, you can have a quick check to see if an array's size is equal to the number of samples that'll make up 5 minutes.  Let's say that number is 5.  If the array size is 5, take the array subset that eliminates the first element.  Add your new sample to the end of the array.  Output this value to your graph and your shift register carrying the array between iterations.  This will build up your array until you reach the five minute mark and then it will only keep the last five minutes of data.  If you need to save the data for longer, use something like TDMS to log the data as you go so you won't lose the data.

 

You'll likely want to take a look at Help-Find Examples and look at the XY Graph.  That will let you control the x-axis in a more meaningful way.

0 Kudos
Message 5 of 6
(3,481 Views)

I have attached a vi with how I have my graph set up before this thread. it is only missing the queuing for the tdms file save but that is working fine and doesnt affect this operation. So the graph shifts forward to keep 240 seconds of data on the screen at all times. I wan to do this but lose eveyrthing that is off screen so that I am not always saving data to an endless array. How do I do that?

0 Kudos
Message 6 of 6
(3,467 Views)