Forums

Full Version: RadialTreeLayout - Here's what I try to do - Need help I guess
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hey guys,

I tried to combine Martins GraphViewRadialTreeLayoutChangingRoot(V1) and GraphMLFileDemo.


Check It (View Source is enabled)
.

So far so good!! Most of this code is written by Martin ofc, what saved me a lot of work, thank you man. You can see in some comments a triplet of question marks, where I just don't know what's going on Tongue. If you got any suggestions to that, let me know.

I didn't change the graphml file yet, cause that can be done later. I won't need a gender, so there's no more determination in the code for that.

What else I'd like to do:

1) Get a search working over the graph (f.e. if you search for "Fernando" you start with Fernando as root node).

2) I'd like to have a separate distance for each edge in the graphml file (f.e. <edge source="1" target="2" distance="0.5" />Wink

If you have any suggestions on that, you 're welcome. 1) shouldn't be that hard I guess(?), but 2) is as far a mystery to me Smile.

Nice greeting to you,
dennis
Hi Dennis,

hope you are well.

Which flare version are you using? The source I saw still uses the "old" visit functionality (return true to continue), but with the latest flare release (2008.04.02) this changed.

If you use the latest flare release, than that would be at least most likely the reason why the colorNodes method doesn't work anymore.

I updated all flap demos so that they run with the new visit logic, so you can either download the new versions or just change the source yourself (return false instead return true in all visit functions ...)

cheers

martin
Hi Martin,

thanks, that's it!! I use new flare release. I missed that one.. The GraphDistanceFilter also seems to work correctly now with TREE_LINKS, since I added the colorNodes function, but don't know why. Before I had the problem, that nodes disapear sometimes.

greetings,
dennis
Hi guys,

some more questions, I hope you can sacrifice some time to offer some help, that would be great (I updated the Source Code): Smile

1) What am I doin wrong with HoverControl and SelectionControl?? I just wanted to add these controls to play arround, but I don't get them working.
2) Why my stupid flex builder says theres no type declaration for GraphViewRadialTreeLayoutChangingRoot, if I delete ":void" I even get this Warning twice, that must be a bug or?

3) If you do some zooming, then click "neue Suche" and load the graph again and try to do some panning the graph flutters arround. Any ideas on that?
edit: just found the solution of this problem: I had to add these controls to vis (new DragControl(vis)) and not to con, which sprite I never remove. Actually I just saw, I have to fix this for my info_panel, too Tongue edit2: good news is I solved this Problem too, bad news is I don't know why this Code is working.^^ You can search for "???" in source code.

4) By moving the InfoBox(top left) the selection square from windows is showing up, maybe you got any suggestion on that, this doesn't happen if you move the vis.. It seems like this exclusively happens when I got the vis showing on myPanel. I got no Idea...

5) Does somebody know, how i can get my logo in the background so that nodes are still clickable when they are above (actually behind) it.

6) If you click on a gender you clicked before, my graph goes crazy somehow.. This happened after I changed this code:
Code:
private function update(event:MouseEvent):void {
            
            var n:NodeSprite = event.target as NodeSprite;
            if (n == null) return;

            // Anzeige der InfoBox
            // ??? if n.data.kurztext is the same as it was before, my graph goes crazy
            if (n.data.kurztext != "") {
                info_panel.visible    = true;
                info_panel.title    = n.data.name.toString();
                info_text.text        = n.data.kurztext.toString();
            } else {
                info_panel.visible    = false;
                info_panel.title    = '';
                info_text.text        = '';
            };
            
            updateRoot(n);
        }
I just can't see, why this should have any effect on my graph and it's edges..

One more comment:
It would be nice if not _all labels would get too large, because just one name is very long. I'd like to cut the name at X characters and make it visible by hover on it (thats why i ll need the HoverControl i guess).

hope you can help me with these problems, thanks
greets,

dennis
Good morning Dennis,

hope life is not too prefused Big Grin

I have no clue about flex, so just a quick remark on the first point. The problem is one of these simple ones, which we we never see once we wrote them. Rather than changing the colors etc of the NodeSprite which is in your demo of the size 0 and only acts as a container, you would have to go for the contained RectSprite, something like ..

Code:
hc.onRollOver = function(ns:NodeSprite):void {
                var s2:RectSprite = ns.getChildAt(0) as RectSprite; // get the RectSprite belonging to this node sprite
                s2.lineColor = 0xffFF0000; s2.lineWidth = 2;
                s2.fillColor = 0xffFFFFAAAA;
            };

cheers

martin

ps the interference of the gender kurztext with edges is indeed very strange - makes me wonder if I should really start learning flex as planned or go back to good old java Wink
Hi Martin,

thanks, ofc my ns.size=0 ...

well, let me put together:

1) solved, thanks to you
2) Is just a stupid bug I guess, i'll check tomorrow at work if I get the same error
3) this works, so who cares. guess i'm just to stupid for as3 sometimes Smile
4) this phenomenon disapeared somehow..
5) this is ok now, cuz i can pan my graph and click the nodes if they were behind the logo, but still would be interessting
6) solved this now with one more if querie:
Code:
if (n.data.kurztext != info_text.text && n.data.titel_kurz != info_panel.title)
            {
                if (n.data.kurztext != "") {
                    info_panel.visible    = true;
                    info_panel.title    = n.data.titel_kurz;
                    info_text.text        = n.data.kurztext;
                } else {
                    info_panel.visible    = false;
                    info_panel.title    = '';
                    info_text.text        = '';
                };
            };
and my graph will be fine.. Smile


two more things:
What must i do, that the textlabels dont all have the same size?? I want them to act like my mouseover longlabels. I was testing and doin, but still don't made it. It has to be some simple change, I guess..

and why does the node titel font look so shitty if you zoom it, if you zoom the info_panel font still looks good..

greets,
dennis
Hi Dennis,

just change this line

Code:
var rs:RectSprite = new RectSprite( -maxLabelWidth/2-1,-maxLabelHeight/2 - 1, maxLabelWidth + 2, maxLabelHeight + 2);
with the values for the individual text label size (getTextLabelWidth(s:NodeSprite) ...)

The zooming is indeed not nice when textlabels are involved, maybe HtmlSprites

http://goosebumps4all.net/34all/bb/showt...hp?tid=110

or device or embedded fonts for the TextSprite do better. Haven't checked on that do to something around laziness

cheers

martin
Hi Martin,

thanks,
but I don't see why the code for my longtitle_rs RectSprite is working then ..
well, fortunately I think it looks better the way it is already Tongue

btw: you are right, zooming looks better with htmlsprites.

Incredible but true, I got one more question. Smile Martin, do you see any chance to implement the distance between nodes from a graphml file, what I metioned in my first post (point 2). I need to adjust the layout for that, right?

The way I liked to add the distance in my first post is not possible in the graphml standart, here's the way I have to do it:
Code:
...
<!-- data schema for edges -->
<key id="confidence" for="edge" attr.name="confidence" attr.type="double"/>
...
<edge source="1" target="2">
<data key="confidence">1.0</data>
</edge>

The attr.type doesn't matter yet and is just an example. The bigger the confidence the nearer the node should be. I think this could will be hard to implement, cause this takes effect on the adjustment of the nodes. Could you give me a hint? Thanks for your great help so far, without you I'd had a very hard time...

greets,
Dennis
Good morning Dennis,

hope you are well. This edge distance stuff is right now also discussed in the java prefuse forum

http://sourceforge.net/forum/forum.php?t..._id=343013

but so far nothing concrete has been found out and since Mr Prefuse Support himself, Bjoern, has given the answer, I don't think there is something there right now (neither in prefuse nor in flare). The only thing I can imagine is that you can trick the force directed layout be adding two edges if the the confidence value is 2.0 and so on. But I have no idea if this would work, for sure not precisely because it is in a way the very nature of the force directed layout that it adjusts itself dynamically and not only according to given values.

Sorry,nothing concerte today.

Cheers

martin

ps just saw that this is about flare in the java prefuse forum ... is it in end you asking? Big Grin
Hi Martin,

no it was not me askin. Tongue
So edge distance doesn't seem possible for me. Maybe you can help me with some alternatives, for example edge color or thickness which I can get from my graphml?

greets dennis
Pages: 1 2 3
Reference URL's