LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to programaticaly add new plots on a Waveform Graph?

Hi all.
I need to create an application on which, just by pressing a button, a new plot is added on a Waveform graph.
Does anyone knows any methods to do this, without having to wire everything by hand everytime a new plot needs to be created?
Thanks alot
0 Kudos
Message 1 of 8
(3,619 Views)
Adding a new plot is not a big issue : you just need to use a 2D array in which each row correspond to a plot.
See the attached vi.

CC
Chilly Charly    (aka CC)
Message 2 of 8
(3,609 Views)
Hi chilly charly.
Well, that works fine, but what if I want to create new plots with diferent X and delta X values?
In your example vi, a 2D array is created, but the x´s are the same for all plots.
What I need is a way to create new plots and new cursors at the same time, and each new plot is going to
have it´s x and y values given by the cursor position.
This way, everytime I click on the add plot button, a new cursor with a bar (plot) is created, and the user will
be able to drag this cursor+bar on the graph and position it anywhere.
Take a look at my example vi, and you will understand what I mean.
On that example, I have made two groups of cursor+bar, but I had to wire the whole thing twice.
0 Kudos
Message 3 of 8
(3,600 Views)
Unfortunately, you can't create a slider programmatically (except going really deep into LV...). However, what you could do is to use an array of cursors has shown in the attached vi.

CC

Message Edited by chilly charly on 04-19-2005 05:46 AM

Chilly Charly    (aka CC)
0 Kudos
Message 4 of 8
(3,575 Views)
If you put the slider into an array, you can increase the dimension for each added cursor. Everything can be done with arrays and shift registers as in my attachment. There are a few glitches, but you can work them easily. Mcsynth
Message 5 of 8
(3,548 Views)
Hi mcsynth
Wow, what a vi!!!
But it gives me an error message everytime I try to add a 3rd slider\cursor, saying this:
"Error 1077 ocurred at property node (arg 2) in Add Cursor Controls.vi
Possible reason(s):
LabVIEW: Invalid property value"
Besides this, it´s seems great, but I will have to spend a few days studying it.
Maybe you can help me a little more, by giving me a short description of how it works.
Thank you very much.
0 Kudos
Message 6 of 8
(3,528 Views)
Hi F_Simon,

That error is one of the glitches I mentioned, although if you press each time, it will continue to add the successive cursors and sliders. If I have some time later this week, I'll try to track down the source of the bug.

All it's doing is adding to the array dimensions of the slider and cursor arrays. You could also put a delete case in to remove any cursor, one at a time. You initialize it with a cursor array constant dimensioned for one cursor and then append to that. You need to dimension the color array for the maximum number of cursors needed. BTW, I put the slider into a cluster for cosmetic purposes only.

The For Loop scans through the slider array to get the length values for each cursor.

It needs work to:

1. find the error
2. keep the position of previous cursors when a new one is created
3. create the proper width line
4. initialize a default slider value and caption
5. control the line color

Hopefully, you'll solve those problems without too much effort

Have fun,
Mcsynth
Message 7 of 8
(3,509 Views)
F_Simon

Here's an updated version with the problems solved. It seems like too much work to do a simple job. I bet there's an easier way.

Mcsynth

PS: I couldn't wait 'til the end of the week.
Message 8 of 8
(3,503 Views)