LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tree to picture (draw tree).

hi all,

i try to draw tree in picture.i have a tree that to contain parent and children.

i want to draw tree that look like flow chart:

                                                                               parent

                                                                chiled1                         chiled2            chiled3

                                                          chiled11  chiled22            

                                                                              chiled23         chiled24

and so further...

see att vi. use labview 2012(win7).

thank's.

0 Kudos
Message 1 of 12
(4,326 Views)

Do you have a specific question or do you simply want to show us your solution? Does it work?

 

Some subVIs seem to be missing (or have been renamed externally after the main program was saved already)

0 Kudos
Message 2 of 12
(4,308 Views)

Hi altenbach,

first thank's for reply.

i try to realize this but not succsess. i have a problem with the location's in the picture.

can help me with that?

regard's

eyal.

 

0 Kudos
Message 3 of 12
(4,254 Views)

I'm assuming you don't want something exactly like what's in the image, because that's a more complex form of graph (it has multiple links). Also, I have no practical experience with this, but I would probably do one of the following:

 

  1. Look for an existing control which already does this. Something like this or this (where you should recognize the names).
  2. Look for some theory on how to do these things (like this). There should presumably be various algorithms for this.
  3. The most naive approach for what you want seems to be the following - start from the top and go down until you find all the leaf nodes. Then, start from the bottom and maintain a count of how many nodes each node owns. When you get to a parent node, add up all its children. By the time you get to the top, you should know how many children each node has, meaning how much horizontal space it needs. You can then use that to start drawing from the top. This is a very quick example, manually drawn in Word:

    Tree.png

    The 8 tells you that you need 8 units of width, 5 for the left side and 3 for the right, and so on. Of course, you could make it more clever if you want to separate the groups by adding additional values for each level, etc.

___________________
Try to take over the world!
Message 4 of 12
(4,235 Views)

Hi tst,

thanks for reply.

i was unable to use this control.i have some progress with my vi but it still not working well.

see att file.if you have any suggestion about this vi it will be helpfull.

regard's

eyal.

Download All
0 Kudos
Message 5 of 12
(4,198 Views)

Hello JTAG

By chance, do you have MathScript? Do you need to have it done only with LabVIEW? 
There is a function in Mathscript called "treeplot" that might come in handy. Here is a link with some references about MathScript plots

http://forums.ni.com/t5/LabVIEW-MathScript-RT-Module/MathScript-Nugget-16-Plots-Galore/td-p/1059557

Regards.
  

Fabián M.
Internal Sales Engineer
National Instruments
0 Kudos
Message 6 of 12
(4,164 Views)

So many ways to not re-invent the wheel here.  I use GraphViz:

 

http://www.graphviz.org/

 

I have a more complex interface, but it is simple to create an example using the array of node names you found, assuming the first column in the parent and the rest are children.

 

GraphViz Demo FP.png

 

GraphViz Demo BD.png

 

simply tweak with the path for dot.exe as well as your choice of size, color etc.

Message 7 of 12
(4,135 Views)

What's the purpose of this picture?

 

Could you use the VI Hierarchy for this?

Create a VI for every child, and grand child, ....

Call child VIs in the Parent VI; call grand child VIs in child VIs; ....

Use VI Hierarchy to show the tree.

 

George Zou
0 Kudos
Message 8 of 12
(4,133 Views)

Hi all,

thank's for replying.

i will check yours suggestions.for know see what i did.

any suggestion/remark about the vi  will be welcom.

regrad's

eyal.

0 Kudos
Message 9 of 12
(4,077 Views)

@Darin.K wrote:

...some very interesting stuff about GraphViz...


Darin, is it possible to extract the locations of the nodes in the generated picture?  I'm thinking about the possibility of adding functionality which would require knowing what node the mouse is over, or what is clicked on.

 

-- James 

0 Kudos
Message 10 of 12
(4,037 Views)