LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem getting the right X-scale data in x-scale scroll.

Hi folks!
I got problem by the scrolling to see all the data when using x-scroll panel for the graph.
If u run the VI, and then stops it U can scroll back and forth to se the history data, But the x-scales, shows wrong data,
I made the x-scales start from 0- , but when running the application, and stops it, one or twice, the x-scale changes to a great value (most the buttom graph)
 
I want when scrolling the scroll panel to see the data that was plottet out on the graph, starting from ZERO.  What to do?
 
Second: When the VI runs and u look at the upper graphs x- axes , although I initialized the x axes by using Proberty node ,s x-scales, it doesn't show from 0-200, but something else.
Is my LV-program stupid or what.!??
Please take a look at my VI-example
Regards Zamzam
HFZ
0 Kudos
Message 1 of 5
(2,846 Views)
The main issue you are running into is that a waveform chart by default only has a history of 1024 points.  when more poitns are plotted only the most recent 1024 are kept.  The rest are thrown away.
 
In your application the top one behaves closer to what you want because it is plotting 1 point at a time.  So the loop has to run 1024 times before it starts to act strange.
 
The bottom graph however gets a large number of points because you keep plotting the entire history of the data.  The 1st iteration of the loop it gets 1 point, 2nd 2 additional points, 3rd 3 more points.  So at this point it now has 6 points total.  Because of the rapid increase in points, it runns over the 1024 boundary fast.
 
So when you ask it to view the data at time 0, that dat ahas been thrown away so it can not scroll back to it.
 
I think what you are really looking for is to make the bottom chart a graph instead.  A graph takes an array of data and shows all that data.  IN this case it would show all the data in the top charts history.  However you will still only ever show a max of 1024 points, due to teh top charts buffer size.
 
Lastly you can change the buffer size by right clicking on the graph and selecting "Chart History Lenght" but a warning.  If you make it too large then you will be hogging a huge amount of memory.  At that point it is probably better to use 2 graphs and manage the arrays of data yourself.  I am not sure if this is an issue for you becuase I am not sure how much data you will be plotting.
Message 2 of 5
(2,832 Views)
I don't understand what you are trying to do. With each iteration of the while loop, you are writing the complete history of "waveform chart" to "strip chart". The history is 1024 points and so you keep appending this array to the previous. The numbers on the x axis reflect how many points have been written to the strip chart. Once the history of the strip chart exceeds 1024, you won't be able to go back to point 0 because those points have been discarded. The x min and max settings control how many points are displayed but that doesn't limit the strip chart to only the first 200 points. In other words, if you write something like 10000 points to the strip chart, the history will contain points 8976 (10000-1024) to 10000 and you will be able to display them 200 points at a time.
Message 3 of 5
(2,831 Views)
Hi HFZ:

' the x-scale changes to a great value (most the buttom graph)'
You are inserting one value into the upper chart, whereas you are inserting the whole upper chart into the lower chart.

If you start with clear charts, the first pass works as you spect. But the second pass will insert a random value into the upper chart and two into the lower one. The third one will insert one into the upper and 3 into the lower. And so on. So, when you scroll the lower graph, you don't get what you spected.
If you start the VI without clearing charts, the fist pass will insert all the upper chart...

I think you will solve your first problem deleting History property, and wiring "strip chart"'s input to the same input as Waveform chart.

Note that "Chart History Length" sets the maximum number of elements you will be able to review.

If you want to see the last 201 values (from 0 to 200), just set Chart History Length to 201. Then you will see max 201 values.

As charts keep track of the values you send to them, they save the value and the index is increment by one.
If you want to see 0-200 all the time you need to replace your Chart with a Graph. But you will have to change your VI a little bit.

Try to find some examples about Charts and Graphs (Help -> Find Examples); when you understand how they both work, you will solve all your problems 😉

Hope it helps,
Aitortxo.
Message 4 of 5
(2,832 Views)
Thank you all for the great help,
U're all right about my mistake,
I didn,t know what i was doing. meaby sleeping  i was, the force  with you may be!!
 
Some how I did not solve my problem about that,
Now i have made some changes to the vi, But as u can see, the chart  always plot the old plotted data, so the new plottet data are plottet on the old plottet data, until the graph or chart buffer are filled. with a greater chart history length, it will be a problem always seeing the old data under the new data on the graph.
 
And as before .. i'm not using the graph, coz it doesn't have history in its proberty node, so how can I clear the history or the graph if i press the clear button?
 
Regards Zamzam
HFZ
0 Kudos
Message 5 of 5
(2,811 Views)