LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Independent cursors on array of cluster of graphs (or work around)

Solved!
Go to solution

Hello,

 

I have been using Labview for a while, but this is my first post here. I have been trying and searching (on this forum and others) for a work around to my issue for quite a while. I have an application which requires two layers of data selection. The first selection dynamically populates an "array of clusters of XY graphs" using two cursors on an intensity image.

 

Next I need to independently select data using the cursors on each of the dynamically generated graphs in this "array of clusters of graphs". However I have found that this is not possible because I cannot use the cursors for each graph independently since they are essentially 'the same graph'

 

I am in desperate need to come up with an elegant solution to this problem. I am working on Labview 2010.

 

Here is what I have considered:

 

(1) I have considered using a chart with separate plots using the 'stack plots' option but charts don't allow cursors.

 

(2) I have considered multiple plots, and messing with the visibility property, but this is not necessarily dynamic because I would have to pre allocate the maximum plots, nor do I think this solution is elegant.

 

(3) I have considered a mixed signal graph, however this is not dynamic either since you cannot programmatically add and remove groups to the graph.

 

(4) I am considering making a custom graph control/indicator which treats the cursors as data as well??

 

(5) Possible to use OO labview to accomplish this??

 

 

I have attached a stripped out version of the program with just the array of clusters of graphs with cursors on them to give you an idea of of what I'm going after. I need to be able to control the cursors independently on several graphs which get generated at runtime, this is absolutely critical for the application. I also absolutely need to have the ability to dynamically size the number of graphs at run time.

 

Any guru's out there who can suggest an elegant work around for this? I would be greatly appreciative! Cat Very Happy

 

Best Regards,

Michael

 

0 Kudos
Message 1 of 21
(4,821 Views)
Solution
Accepted by topic author mkabatek

You could try something like this - http://forums.ni.com/t5/LabVIEW/User-interface-problem-list-of-clusters/m-p/2311770#M726599

 

Effectively, this is an "array of subpanels", where each subpanel can show a completely separate graph and you put the handling code in the subVI. The main issue for you would probably be that you need to move data to and from the VIs. You can use events or FGVs for that (with the events you can either use one event and include ID data in it, or use a separate event for each VI and do a lookup to get its reference.

 


___________________
Try to take over the world!
Message 2 of 21
(4,805 Views)

tst,

 

Thank you! It definitely works. I can make a plugin with my graph and control the parameters of each graph independently. I do however have another issue of accessing the plot data and cursor data from the graph using VI references. Any idea how to do that efficiently? I would like to use your suggestion of a single an event case with and Id for some kind that can populate the graphs with external data, pipe the date and cursors info out of the graph but I'm not exactly sure how to do this using VI references and property/invoke nodes. I would like to avoid using FGVs if possible.

 

Either way thank you very much for your input!

0 Kudos
Message 3 of 21
(4,783 Views)

I don't think I would use the VI refs for getting the data. If you want a two way comm, you can create one event for sending the data (a convenient mechanism for such a global reference is a VI which uses the First Call? primitive to create the event and then only returns the created reference on subsequent calls) and another event (or several others) for sending the data from the graphs.

 

If you do go this way, make sure the first call to the VI happens in the main VI, because if it will happen in one of the dynamic VIs and it goes out of memory, LV will automatically clear the reference.

 

Since you mentioned OO, another thing which you might consider is the actor framework, which is exactly designed to deal with parallel processes communicating with each other, but I think the only versions you will find which are saved for 2010 are fairly old versions, which have some childhood issues.

 

P.S. If you come up with something presentable, it would be nice if you post it here. Someone else might benefit from it too.


___________________
Try to take over the world!
0 Kudos
Message 4 of 21
(4,774 Views)

Thanks. I will definitely post once I get it up and running. However, I do have one additional question. I noticed that the stop button is somehow 'global', and you can see that event signal (stop) across all VI in their event cases that regester the event using the STOP EVENT.vi. I have tried to reproduce this be cannot seem to figure it out. How is this accomplished?

 

Thanks again for your insights.

 

{Edit}

 

Sorry I think i figured it out

0 Kudos
Message 5 of 21
(4,763 Views)

tst,

 

So I have events setup, and I can Tx and Rx data from the main VI to and from the plug in. The problem now is that I cannot send and receive from a specific plugin. It goes to all of them. How would I selectively choose which instance of a plugin I send and/or receive from? Sorry if this is obvious...

0 Kudos
Message 6 of 21
(4,747 Views)

That's what I was refering to when I mentioned the ID - you can add an ID for each VI (use the Set Ctl Val method to pass it to the VI before running it) and use that to identify which VI the event belongs to. The other alternative is to create a separate event for each VI.

 

The one event method is simpler and doesn't require the caller to register for multiple events, but it creates a problem where all VIs recieve the event and have to filter it themselves. You could do a mix where you have multiple events to send to the VIs and one event to send back.


___________________
Try to take over the world!
0 Kudos
Message 7 of 21
(4,727 Views)

Hello tst,

 

Finally got around to posting this, I got wrapped up in work for a while 🙂 I made a little mod of your program that can Tx and Rx data to and from the subvi's. This is very basic, but works. This is probably not the best implemetation for doing this. I think going to OO would be better in the long run for stuff like this. I might retool the program in OO and post it if i ever get around.

 

Thanks again for your help! It was much apprecaited! It definitely solved the problem.

 

PS. you can set data in Plugin 3.vi as well as get data with two arrays (get/set). There is an index for which instance of the plugin you are dealing with. Ultimatly in my program that implemets this framework - I ended up tagging each plugin with a ID for each plugin instance as a way to keep track of stuff. Either way thanks again.

 

Best Regards,

Michael

0 Kudos
Message 8 of 21
(4,682 Views)

Hello tst,

 

I have another question about this framework. Say I would like to open multiple copies of this plugin framework (completely independent reenterant vi's, in separate windows), each with different data? How would I accomplish this? I have attached an example of what I am trying to accomplish.

 

I added a vi to the project called Open.vi which contains two buttons, one button to open a new instance of the plugin framework, and another button to stop everything.

 

However it does not operate as intended. When I open a second copy, and click add, to add a plugin- the plugin gets added to the first copy of the Custom Listbox instance. I am using the "start asynchronous call" block, however I have tried this with call by reference, as well as an invoke node to open the front panel. I can't seem to get completely separate instances of the Custom Listbox vi to open and operate.

 

I have also tried to use an invoke node with Main.vi saved as a vi template (*.vit). I thought I could open multiple copies of the same vi, however the plugins always get linked back to the first instance opened.

 

Any idea how to work around this so we can have completely separate instances of the plugin framework, with completely independent data sets?

0 Kudos
Message 9 of 21
(4,642 Views)

Let me be very clear - this is NOT a framework. It's a quick and dirty example demonstrating the concept, nothing more, so you should treat it as such. If you plan on using this, you had better make it into something more proper.

 

Specifically, the reason for what you're seeing is simple - I used a single VI to get the event reference for passing the list of VIs to the subVI. When you call the second copy, it uses the same event reference, so it updates the first subpanel (although, as you can see, it resets the list, because the actual list of VIs is kept in the main VI, another thing which is good enough for a quick example, but should not be used in proper code).

 

I would probably move the management of the entire thing to a class, then create a reference to an instance of the class at the beginning (a DVR) and pass that into the subVI. That will also be used to manage all the references.


___________________
Try to take over the world!
0 Kudos
Message 10 of 21
(4,631 Views)