02-03-2016 04:42 PM
I have been wrestling with charts in LabVIEW for over a decade. For the first five years or so of LabVIEW programming I even though it was impossible to plot a chart. The examples are useless as they realy do not explain how or why they work. They are made to polt a pretty graph but they can not be used for any other purpose
All I want is a simple chart I can wire measurments into with each one drawn on a seperate plot and the current time in the X-axis.
All plots and the X-Axis is updated at regulat intervals.
Why is this so freakin' difficult?
I have tried the "wire current time to X-axis offset trick" (why do we still have to do stupid tricks like this?) but the axis does not update
Solved! Go to Solution.
02-03-2016 04:50 PM
02-03-2016 05:05 PM
@RTSLVU wrote:I have tried the "wire current time to X-axis offset trick" (why do we still have to do stupid tricks like this?) but the axis does not update
If you want a absolute time formatted x-axis and the updates occur at regular itnervals, all you need is set x0 (x-scale offset) to the current time once at the start of the program. All later times are calculated from the dt (x-scale multipler), even after the history size is exceeded.
There are no tricks (stupid or otherwise) involved.
Please show us your code, maybe you are doing things wrong (e.g. update x0 with each iteration or similar).
If you think that the examples are not good, provide constructive feedback to NI. I am sure they would appreciate it. Thanks!
02-03-2016 05:17 PM
Here is my code, or at least the top level VI.
I set x-scale offset to the current time at the start of the program in the "start" case.
My graph shows the time the program started at both ends of the X-axis and it does not update even as teh chart starts to scroll to the left it always shows the same time.
02-03-2016 05:40 PM
The scale will start moving once you have exceeded the history buffer size. Before that, only the right side will move, of course, because your x scale is set to autoscale and it will do that until 3600 points have been added.
02-04-2016 10:01 AM - edited 02-04-2016 10:08 AM
@altenbach wrote:The scale will start moving once you have exceeded the history buffer size. Before that, only the right side will move, of course, because your x scale is set to autoscale and it will do that until 3600 points have been added.
Hmmm... Okay maybe I was not waiting long enough?
Anyway how do I make a chart that will start out with the current time on the left end of the X-axis and current time plus one hour on the right.
Then once the data reaches the right end the chart should scroll to the left always showing the last hour of data on the chart?
02-04-2016 10:14 AM
02-04-2016 10:18 AM
@altenbach wrote:
- turn off autoscaling
- Set the xmin to t0 and xmax to t0+1hour at the beginning of the run. After 1 hour, the markers will start scrolling.
- Set the chart history lenght to exactly 1 hour of data based on dt (this can only happen in edit mode and cannot be changed during run).
- Actually it is probably sufficient to set the chart history to >1 hour as long as the visible range is 1 hour. the extra data would simply scroll of and could be retrieved by showing the x scrollbar.
- Another possibility would be to set t0 to "current - 1 hour" and set the chart history to an array of NaN data equivalent to one hour. (I have not tried this).
- ...
Should I still set Xscale.Offset to the current time at the beginning of my program?
02-04-2016 10:42 AM
Yes, if you want to have the markers in absolute time.
02-04-2016 11:06 AM - edited 02-04-2016 11:10 AM
That does not seem to work for me.
Here I set the X-scale min to the current timh and X-scale max to the current time + 3600 (1hr)
But my chart X axis only shows a couple minutes AND the X-axis is not keeping up with the data.
I took this screen shot at 9:03 the chart is holding about 15 minutes of data but the X axis does not match up with the data.