12-12-2018 04:10 AM
Hello everybody
I am trying to spawn a graph. Hereby I attached a simple case in which I put two random inputs for the graphs.
My question is how can I have the updated graph on each one?
Any suggestion?
VI is the main and Cp is the vi used in the main.
12-12-2018 04:51 AM
It depends very much on what you want exactly. It's not exactly clear.
If you want the data at the time the button is pressed in the new graph, you'd need to set that data using the set control value method, before running it.
If you want each graph to continuously update the data, you need to put it in something global. Either a global, a functional global, a channel wire, a DVR, a queue... Anything that can be referenced asynchronously. And then perhaps you need to pass the reference to the graph VI, unless you're going for a FG, or chose to use a named queue, or to put the reference in a (F)G, and so on...
Note that the event structure (used like this) is not a stable timer... Of course it's OK for a mockup.
12-12-2018 06:08 AM
First of all, thank you for your response.
Actually, in the end, I want to measure continuously different points temperature and show them on the graphs. I have used a random number instead. So I mean continuously update the date and by pressing the spawn graph button show a new graph with the same values and also updating.
I have found a solution for spawning but if I use "Call by reference" block to update the values there is no data on the graphs.
12-12-2018 08:28 AM
@Rez.mhni wrote:
I have found a solution for spawning but if I use "Call by reference" block to update the values there is no data on the graphs.
In the posted VI, that makes sense. How would the VI get the data? There's no link to the data...
12-12-2018 09:11 AM
This is exactly my question. If I use "Call By Reference " as you can see in the picture the value would not be shown on the graphs.
I am not sure that using call by reference is the correct way for updating data.
Do you have any idea?
12-12-2018 09:44 AM
@Rez.mhni wrote:
Do you have any idea?
Yes, as mentioned:
If you want the data at the time the button is pressed in the new graph, you'd need to set that data using the set control value method, before running it.
If you want each graph to continuously update the data, you need to put it in something global. Either a global, a functional global, a channel wire, a DVR, a queue... Anything that can be referenced asynchronously. And then perhaps you need to pass the reference to the graph VI, unless you're going for a FG, or chose to use a named queue, or to put the reference in a (F)G, and so on...
As an alternative that was not mentioned, you can start the VI, and get a graph control reference (in 10 different ways). Then the main VI can put the data in those references when updating.
12-13-2018 07:17 AM
Actually, I did not get what you said. because if I use control reference or something like that I will miss the spanning part.
To be more precise I attached the picture of my VI in which I can have the data continuously but the problem here I can not have spawning anymore. I want both of them at the same time.
12-13-2018 08:32 AM
Don't you need to Open VI ref when using Start Asynchronous call?
/Y
12-13-2018 08:39 AM
Take a look at these VIs. At the first VIs I have Spawning but not updating data and in these VIs specifically upper part I have updating data but not Spawning.
I need to have every time a new windows with updating graph by pushing that button.
12-13-2018 08:50 AM - edited 12-13-2018 08:55 AM
The problem is that you are passing in a snaphot of the graphs data rather than a reference to that data.
You need someway of referencing the data itself like :
Although personally, I'd rather use a Notifier. (you don't have to poll fo val changed like you do with the DVR) as this could spawn multiple independent graphs