LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY graph help

Solved!
Go to solution

Could you attach the actual VI instead of a picture?

0 Kudos
Message 11 of 20
(1,164 Views)

I typically prefer complex data for xy graphs. Try something like this.

 

 

(Of course the plot names need to be set only once)

Download All
0 Kudos
Message 12 of 20
(1,158 Views)

So I noticed that when I changed my block diagram as shown in the attachment, my "reset graph" case doesn't work anymore.  It clears the graph, but then as soon as I hit "stop" or que up another run, all the data is put right back on the graph. 

0 Kudos
Message 13 of 20
(1,126 Views)

There is my .vi, along with the table data sub.vi and the table I am getting my data from, if you dont like the pics.

If you send me .vis, remember LabVIEW 8.5 please!

Download All
0 Kudos
Message 14 of 20
(1,122 Views)

@LarsUlrich wrote:

So I noticed that when I changed my block diagram as shown in the attachment, my "reset graph" case doesn't work anymore.  It clears the graph, but then as soon as I hit "stop" or que up another run, all the data is put right back on the graph. 


You have a classic race conditon due to the overuse of local variables. Your local variable is read immediately and the value placed in the tunnel. Even though you clear the graph, next time the lower queue is triggered, the stale value is read from the tunnel and put back into action.

 

As a quick and ugly bandaid solution, place the ."read local" inside the case structure.

0 Kudos
Message 15 of 20
(1,118 Views)

Lars,

 

Altenbach is right, it's because you've wired the data through the case structure, placing the read inside will fix the issue.

 

Whats effectively happening is when you press stop, the Queue reference is getting destroyed. This is causing your de-queue in the bottom loop to go into the error case and pass the data it has already read from the xy graph back into itself.

 

I would recommend actually utilising your queued message handler architecture, see attached for a slightly improved version. Ideally your Queue data-type would use a type-defined enum to select the state to execute instead of a string. Your Reset Graph event should queue a "reset" state to the bottom loop which then handles the action.

0 Kudos
Message 16 of 20
(1,106 Views)

Well that fixed my race condition and the reset problem, though now it correctly names the plots, but it plots the data in plots 3, 4, and 5 instead of the renamed plots 0, 1, and 2.  It skips over the first 3 for some reason, and the colors of the lines don't match up with the legend.

Download All
0 Kudos
Message 17 of 20
(1,105 Views)

Hi Lars,

 

it looks like you pressed "reset" which initialised your graph with 3 empty plots. Then whats happening is your concatenating a further 3 plots creating a total of 6. You will need to use replace array subset

 (see image) if you wish to do this.

 

Attached image will overwrite the data for plot 1...

 

Message 18 of 20
(1,089 Views)

Try something like this:

 

Your code still has serious problems. For example why do you need to read the entire file over and over again, just to extract a different row each time? You can get the entire data in one swoop. None of your controls should be in the inner FOR loop. Their value does not change during the microsecond when the loop executes, so why read them over and over?

Message 19 of 20
(1,083 Views)

Alright, looks like it is working so far, thanks for all your help.  I'll try and think about some of your other suggestions, some of them won't work for me though because the .vi I have been attaching is not the program I am writing, it's just a little ditty I've been using to figure out this graph, the actual one is much larger, and does actually utilize the producer/consumer design to run different tests.

0 Kudos
Message 20 of 20
(1,067 Views)