LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make trend mode graph?

I want to make a trend mode. For the trend mode: When the signal  graph reach the biggest x axis ( in panel) , the graph will compress
Download All
0 Kudos
Message 1 of 8
(4,180 Views)
Hi ha noi,

I modified your example so that it demonstrates the behavior you describe.  The basic idea is to use the chart property nodes to change the X scale so that all the points are always visible.  Keep in mind that the chart control only keeps a set amount of data in memory (default of 1024 points), so after this old points will be discarded and only the most recent 1024 point will be displayed.  This is a limitation of the chart object, and cannot be changed programatically.  However, you can increase the amount of data points that are stored by right-clicking the chart on the front panel and going to "Chart History Length...".

I hope this helps!
0 Kudos
Message 2 of 8
(4,129 Views)

hi  

Your example, i can use for roll mode graph. The trend mode, which i want to do ,is different. I attacht the explaination with picture. I hope some one can give me the idea to slove it! Sorry about that i did not explain about graph. Thanks you for your reply.

0 Kudos
Message 3 of 8
(4,112 Views)
Explaination with picture
0 Kudos
Message 4 of 8
(4,110 Views)
This is the program i try to calculate data. how  can i display in only 1 graph?
0 Kudos
Message 5 of 8
(4,076 Views)
ha noi,

I am a little confused as to what is going on in the VI you posted, but I think I understand what you are trying to achieve based on the visual description and original image you posted.  I will see if I can put together an example that you can adapt for you application, but I'm not totally sure about a few of the finer details.  For example, are you always reading data in a constant chunk size (such as 12 elements per read, as in your explanation picture)?

Also, supposing there is a constant chunk size of 12:
On the first "period" where each bar represents one data point, a chunk is going to add 12 bars to the graph.
When each bar is representing 2 data points, each chunk will add 6 bars.
When bars are being scaled by 4, each chunk will add 3 bars.
But what happens after that?  When we start scaling by a factor of 8, chunk sizes of 12 aren't evenly divisible.  Each chunk represents 1.5 bars of the graph (12 / 8).  So what I was thinking is that you would use the average of the first 8 data points for the first bar, and then the remaining  4 data points to make up a second bar.  When the next chunk of data is read, bars would be recalculated so that there would be 3 bars (24 total data points / 8 = 3 bars).  It would continue this want until the next scaling was made to combine 16 points per bar.
When this happened, things would continued in the same way.  The first chunk would stil only be 12, so they would make up one bar.  After the second chunk there would be 24 data points, so a total of 2 bars (16 in the first bar, 8 in the next).

This method would be fairly scalable I think and wouldn't require a constant chunk size.  The only thing is that all raw data for the second half of the graph would need to be stored with bars recalculated each iteration until the next "divide down" is required.  After being scaled to the first half of graph, the raw data could be discarded and only the bar values for the first half would need to be stored.

So, any further information or clarification would definitely be helpful!
0 Kudos
Message 6 of 8
(4,037 Views)
Thank for your help! This is the way i want to do! you can take a look at my VI, maybe you can give me some good advice! Thx.
 
0 Kudos
Message 7 of 8
(4,025 Views)
You're welcome.  I'm glad you were able to get things to work!  I tried looking at your code, but it was not very easy to follow the logic.  If you clean things up a bit and add comments to the code (double-click on the block diagram and start typing), it can really help explain what's going on.  This can be helpful to others viewing your code, as well as to you if you ever need to modify it in the future.

You chould also consider changing the constants (such as the 8 and the 4) in your code to controls and adapting this to be a sub-VI which takes inputs and produces an array output for a graph.  This was you could make the code more scalable to other applciations and graph sizes.

Again, good job on implementing that graph!
0 Kudos
Message 8 of 8
(3,994 Views)