08-16-2023 04:29 PM
I found the attached two VIs that plot multiple variables in Labview's examples. As you can see it plots multiple variables with moving window, starting from the right vertical edge and moving left with the most recent value on the right. The only change I would like to make is to start with the left edge and move the latest point to the right until it reaches the right edge and then keep shifting the value at the origin. I tried to manipulate the Xrange parameters but no combination I tried did what I wanted. I guess I don't fully understand the role played by 5 range parameters, increment, maximum, minimum, minor increment and start. I thought that programmatically changing the minimum and maximum will do the trick. But in the block diagram they are set to the same value. Also, the increment and start are assigned the same value. So I don't know what to do to get the behavior I want.
Thank you for your help.
Girish
08-16-2023 07:30 PM
From the "period to display in minutes" and the loop rate, you can calculate the needed chart length. You overload the x-scale with conflicting information.
Since your time points are spaced equally in time, it is not clear to me why you don't use a plain chart instead. Should work much better.
08-16-2023 07:44 PM
@altenbach wrote:
Since your time points are spaced equally in time, it is not clear to me why you don't use a plain chart instead. Should work much better.
See if this can give you some ideas....
08-16-2023 07:52 PM
OK, I was curious why your Charts filled from right to left -- mine always went left to right. Then I looked at the code in the left edge of the VI, where you initialize the data that you are planning to plot.
Most of us (myself, included) initialize a Chart which has no data in it with "no data", or an empty array. When you plot "nothing", it starts on the left edge, starts moving left-to-right, and when it reaches the right edge, it starts updating in a matter that depends on what kind of Chart you have. If you use the default "Strip Chart", the "paper" in the Strip Chart (think an EEG or EKG machine with moving paper and pens that go up and down, drawing on the right edge of the paper).
But you didn't start with "nothing" -- you carefully filled your Data Array with NaNs, which don't put points on the plot. So it might start at the right edge (because you add points at the end), and because all the "visible" points are being added at the end (right-hand-side), it "does what you asked it to do", implements a true "Strip Chart" where all of the data comes in on the right edge, with all the earlier points slipping left.
I only looked at "XY Chart Buffer". Just a sec while I look at "Plot IC" ... Aha! You aren't using a Chart, you are using a Graph!
Look -- NI went to a lot of trouble to make really useful Charts for showing "evolving data" (the kind you get when you are recording time-varying phenomena, something LabVIEW does very well). Look at some of the Chart and Graph examples, learn how (and when) to use each.
Bob Schor