LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plot initialization takes a long time

Hello,
I've attached a vi that is a copy of some code I'm using in my application.  The behavior I want is for the strip chart to scroll from right to left.  The newest data will be added to the right side of the screen and scroll left, like a strip chart.  For this reason, the right side time is shown as 0 and the left side is shown as negative time, taken from the seconds to graph control.  It works just fine in my application with two exceptions.  When I set seconds to graph to a low number, say 1 second, all is well.  When I set it to a high number, like 100 seconds, the initialization takes a long time.  Based on this code, I've narrowed it down to the graph init time, and not the init of the arrays.  Is there a faster way to accomplish this same behaviour?  In addition, does anyone know why when the seconds to graph control is set to numbers greater than 30, the left side of the x-axis holds at -30, but for numbers less than 30, the left side shows that number?  It's supposed to show a negative of whatever the seconds to graph says.
Thanks.
0 Kudos
Message 1 of 8
(2,852 Views)
I don't quite understand what you are doing and why. With a 100 second time to graph and the default sample rate, you are creating an array with 200,000 elements that you are sending to both the history and marker vals. To initialize the chart, you want to send an empty array to the history. And what is the purpose of sending all of that data to the marker vals?
0 Kudos
Message 2 of 8
(2,840 Views)

I think I've found the reason for the x-axis scale not working properly.  It appears that there is an upper limit of around 30,000 points that this waveform plot can hold.  Now, I just need to know why it takes so long to init.  Any ideas?

Thanks.

 

0 Kudos
Message 3 of 8
(2,839 Views)

Yes, you are creating an array of 200,000 points for both the history and marker vals. Don't do this.

And, you set the max history of the chart to 30,000 points. The default is 1024 so you had to have changed it at one point.

0 Kudos
Message 4 of 8
(2,834 Views)
I'm not sure why things are the way they are.  I'm relatively new to this and this was a solution I received a while back from NI direct support.  I do remember changing the default size based on the solution offered by NI.  I've used it for a while now, but now some are trying to view so many points at once, which has revealed the problem I described.
0 Kudos
Message 5 of 8
(2,828 Views)

Dennis,

Thanks for the call about the marker values.  When I received the solution from NI, I just copied it over and it worked.  I never dug into how it worked.  I just removed the array to the marker values and it inits quickly now.  Thanks.  As for the history, best I can remember, the original chart drew and compressed the plot as data were added.  I wanted a chart of fixed width that would init to nothing drawn, and have the drawing itself scroll across from right to left as the time ticked off.  It's working great now.  Thanks.

Rick

 

0 Kudos
Message 6 of 8
(2,822 Views)
Initializing a chart to nothing is much different than wiring a large array of NaNs to the chart. Get rid of that part as well. The correct way to initialize a chart is to wire an empty array to it as I mentioned. Delete the wire to the History input of the property node. Then, right click on the History property and select 'Create Constant'. You now have an empty array.
0 Kudos
Message 7 of 8
(2,818 Views)
Ahhh, that's perfect.  Thanks Dennis.
0 Kudos
Message 8 of 8
(2,814 Views)