LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic dispatch XY plotting?

Hi all,

 

I'm trying to do XY graphing where two classes create and format curves to be added to an XY graph. There's many ways to do this, but I can't seem to decide on one. I could use the call chain to get references to the graphs and modify them via a property node, or I could use some sort of queue to have them each add their data and let a Graph class do the formatting, but I lose out on the dynamic dispatching of the original two classes (unless I pass a reference to the two classes into the Graph class, but that seems messy) if I implement it that way.

 

We know at runtime which graphs the two classes will send their data to, so it doesn't need to all be done through property nodes, but I'm not sure.

 

I also want the ability to tell the graph to load the actual data from either a functional global or from the data log, which means I'd have to have some sort of GraphMemory VI which would be coupled to my logging class. Does graphing need to be a method within the logging class?

 

Any ideas?

0 Kudos
Message 1 of 6
(3,095 Views)

Hi

Your description is a bit confusing. I think you may be overthinking this.

 

I would try the first way and go with it (the less messier one), if you know how to do it with property nodes, is there a reason you don't want to do it all through property nodes? just keep an order in the block diagram and you should be fine.

 

Are you simulating the data or are you already loading the data to the graph? To load data from a functional global or the data log, I would do it on a simple VI and then implemented on the VI that you are working on.

 

 

 

0 Kudos
Message 2 of 6
(3,042 Views)

If I understand what you're trying to do, I'd tend to agree with niarena.

 

Do you want the graph to be a part of the class itself?  More specifically, are you adding the XY Graph to the properties of the class so each instance spawns a graph?

 

Or, are you looking to take the data you create and format within the class and output that to the graph?  If you're looking to do this, why are you so focused on property nodes?  You don't need references.  Let's say your dynamically dispatched VI is called "Get Data" so each class has the Get Data.  It can output the formatted data.  From here, it's a simple wire from Get Data to the XY Graph and you're set.  You have the dynamic dispatch as each child class has the Get Data.  They share the same output data type.  They feed into the same XY Graph. 

 

Is it possible to share a small UML Diagram to explain what your properties are for the two classes so it's a bit easier to understand the overall concept you've got to work with here?

0 Kudos
Message 3 of 6
(3,030 Views)

Heres an example of what I want to achieve:

 

The curves marked by a red arrow are "model" curves. The cyan curve is a model curve, it was hard to tease it out from the white curve. The curves marked by a blue arrow are "controller" curves. When programming new instances of a controller or model, I'd like the ability to decide which graph the curves go to, and in what order. This seems like it would require there to be some sort of graph class to handle a queue of some sort, but since the controller and model run sequentially, I'm not sure if it's possible to intermingle the curves in an arbitrary order. Thoughts?

0 Kudos
Message 4 of 6
(3,015 Views)

Check on 'Using Overlaid and Stacked Plots' on this link, overall that article has several tools to customize the graphs
and on the 'Drawing to the Graph Plot Area' there are links to the 'Plot Image Properties' to customize the plot area
http://zone.ni.com/reference/en-XX/help/371361F-01/lvconcepts/customizing_graphs_and_charts/


The way I use to program is to build a simple version of what I want and build up from there, it simplifies everything, particularly in this case because sometime when you work with log data it can be misinterpreted; you can do it with simulated signals so you are sure of which signal you are seeing and once you have the result you want, attach the data.

 

Are you starting from scratch or have you already work on it?

Message 5 of 6
(3,001 Views)

I've already worked on it, but I'd be willing to start over if I found something compelling!

 

Here's the guts of the current setup:

 

 

In order:

 

1. Read off the model

2. Dynamically Dispatch to the model's method for assembling a row to append to the graph.

3. Read off the controller

4. Dynamically Dispatch to the controller's method for assembling a row to append to the graph.

5. Append the rows together, with model curves coming first

6. Add them to a reentrant XY Chart, reset if the time is 0, eg the application just restarted.

 

The main problems are that the Model and Controller are required to be read for this method, and that the order in which the curves appear is set (model curves first, then controller curves).

0 Kudos
Message 6 of 6
(2,997 Views)