From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph with chart behaviour

Solved!
Go to solution

I would like to ask for advice for how to handle the best way the following scenario:

 

I frequently update an XY graph, with 12 curves. I have created a ActionEngine subVI which acts as a buffer (add points, read data out) for the graph, and has some other actions, like empty the buffer, decimating the data points, etc. So at 1 Hz rate I send the 12 curves data to this XYGraph, and it redraws itself, all is OK.

There are 12 ongoing DAQ tasks, with 1 Hz rate, I want to show the user how the curves are evolving. It is also important to have a vertical cursor line so the user can examine the values at different time stamps (X -values are absolute time stamps). All is working nice, except that, when I turn off the X-autoscale, so the user can only see lets say the last 1 hour of data points (3600 points X 12 curves, I know I should decimate usually, but LabView usually handles quite OK the situation when you have more points then pixels...at least I can live with this).

So the problem: if X autoscale is off, and I send the new datasets to the Graph at every second, the Graph does not show the new points at the right side, like in the case of a chart. How shell I make the Graph handle this situation? Shell I set the "max" (X-scale - Range - Maximum property) of the x-scale via property nodes at every second? Is this OK to do? Any other idea?

 

A kind of workaround could be to use the XY-Graph AND a Chart. The user could inspect lets say the latest 1 hour of data with the chart (or by turning off autoscale, the last few minutes if needed), and the XY-Graph would work as an overview, the user could update it manually by a button, and after that playing with the zoom functions, etc...

What do you think? How do you handle such a DAQ application? So the user needs to see whats happening recently with the curves (pressures, flows, temperatures), but also be able to inspect the evolution of the curves of the last 24 hours...

 

edit: hmm, usually I get new ideas after writing down my problem 😄 I think I try to attack the problem from the wrong side: instead of fighting with the Graph properties, I could just create a "Set Range" action in my buffer subVI, so when the user want to see lets say only the last 10 minutes of data, I only send these data points from the subVI to the Graph... hmm I think this would be a nicer solution... what do you think?

0 Kudos
Message 1 of 10
(3,422 Views)

You could try using sweep mode to update your chart.

0 Kudos
Message 2 of 10
(3,394 Views)
i am talking about a graph, not a chart. i need cursor.
0 Kudos
Message 3 of 10
(3,386 Views)

Ah, missed that.  I mean, you could replicate the functionality fairly easily using an xy graph I think.  Initialize an array, use a 2nd locked cursor for the sweep position, and replace array subset with each new update. Could even be part of your action engine

0 Kudos
Message 4 of 10
(3,380 Views)

You mean, I add second locked cursor (could be invisible by its colour), and update its location at every update to the last time stamp? Why is this better compared to setting the max of the X-range property?

0 Kudos
Message 5 of 10
(3,366 Views)

It was just an idea!  My thought was that way you could real time update the data, while having old data stationary for your users to view, zoom in on, etc.

0 Kudos
Message 6 of 10
(3,356 Views)

hmm, I see! I will think about it, and test different scenarios to see what is more handy for the users...

0 Kudos
Message 7 of 10
(3,350 Views)
Solution
Accepted by topic author Blokk

Here are some options. You can consider them based on your actual application:

 

  1. A mouse down event on the graph opens a new VI, where you put all the data you want and let the user play with it. When they're done, they close it and you go back to the live graph. This is in some ways easiest, because you're working on a separate copy.
  2. The range of the actual data fed to the graph is controlled by a separate X scrollbar. The scale is then set to autoscale. When the user changes the value of the scrollbar or zooms, you stop updating the graph. You resume updating after a timeout or after the user brings the scrollbar to the max value or after they press a refresh button.
  3. You feed all the data into the graph, but control the X scale yourself. In this case, you still need to decide when to stop changing the scale and when to go back to it.

___________________
Try to take over the world!
Message 8 of 10
(3,320 Views)

Hello,

 

Thanks for the useful hints! I just decided for now, I try to go with the built in functions (zoom, autoscale on/off, etc.) of the XY Graph, and I proceed the following way:

I keep a maximum amount of data of 24 hours (24 * 3600 * 12 sensors of data points) in an Action Engine SRs. The user can set how many minutes/hours he/she desires to see of the newest part of the data. Usually the operator only needs to see an about 10 minute large time window for monitoring purpose, so it is good, I use less points (600) compared to how many pixels I have horizontally in this XYGraph.

If the user wants to see larger amount of data (maximum 24 hours), I feed the data into the Graph, stop updating the Graph, and the user can zoom in/out, and pull a cursor to examine data at the different time stamps.

So I think for this particular application this approach should be OK...

 

I was searching the forum for some Graph related info, and I read interesting suggestions to improve performance in case of large data display. Like this one:

http://forums.ni.com/t5/LabVIEW/how-is-graph-data-resampled-to-pixels/m-p/1815823/highlight/true#M62...

See the last two posts from Darin.K and Ben.

 

Regarding to this I have some questions:

  1. All the 12 sensor data have only 1 or 2 valuable figures after the decimation point. I guess I could store the data in the AE's SR not as double but as single float numbers? So I would half the memory requirement of my data buffer. Also, if I feed SGL precision data into my XYGraph, I should get better performance, is that correct?
  2. Plot styles: hmm, what can impact the Graph drawing speed, like the antialiasing I guess, is that correct?
  3. I wonder if I should set the "skip when tabbing" property node ON for the Graph when a larger data is loaded into (I have a TAB control, and the Graph is in the second page)? So if the user wants to check some indicators on the first page, and "TABs" away, the Graph will not slow down the application.

Thanks!

 

 

0 Kudos
Message 9 of 10
(3,240 Views)

Blokk wrote:

Regarding to this I have some questions:

  1. Also, if I feed SGL precision data into my XYGraph, I should get better performance, is that correct?
  2. Plot styles: hmm, what can impact the Graph drawing speed, like the antialiasing I guess, is that correct?
  3. I wonder if I should set the "skip when tabbing" property node ON for the Graph when a larger data is loaded into (I have a TAB control, and the Graph is in the second page)? So if the user wants to check some indicators on the first page, and "TABs" away, the Graph will not slow down the application.

  1. No idea. My instinct is that there will be at most a minimal increase in performance, as the speed is probably affected less by memory allocation and more by the drawing, which I'm guessing is not impacted by the precision, but that's just a guess. You can test it and see if you see an improvement.
  2. At the very least, anti-aliasing should take some CPU cycles, but I don't know how prononounced the effect is.
  3. I'm not sure if you can tab into an indicator. I'm not sure if you can tab into a control in another tab page. In any case, you can certainly set the property. At most, it won't do anything.

___________________
Try to take over the world!
0 Kudos
Message 10 of 10
(3,209 Views)