Hi - I'm a Flare newbie and Actionscript intermediate. I'm working on creating a network topology map using Flare, and right now I'm using the RadialTreeLayout. However, I'd like to be able to provide more absolute positioning. My attempts to edit the NodeSprite's x and y values haven't done anything.
P.S. I also haven't figured out how to change EdgeSprite lengths, if anyone can lead me towards that answer...
Many thanks!
linus
public static function buildNodes(vis:Visualization):void {
var ns:NodeSprite;
//Format label text
var fmt:TextFormat = new TextFormat();
fmt.font = "Arial";
fmt.color = 0x000022;
fmt.size = 11;
fmt.bold = false;
vis.tree.nodes.visit(function(ns:NodeSprite):Boolean {
// Add labels to nodes
var lan:Labeler = new Labeler("data.name",Data.NODES,fmt);
lan.verticalAnchor = 100;
lan.yOffset = 20;
vis.operators.add(lan);
Are you still using the RadialTreeLayout? That would "override" whatever position you give to your nodes initially.
In regard to the length of Edges, with exception of the ForceDirectedLayout the length of a edge is in general determined by the position of the nodes, so the layout classes position the nodes and the EdgeRenderer draws an edge between connected nodes (the shape of the edge might of course vary and by that the length but that is not your point I guess). In the RadialTreeLayout the distance of the nodes is either calculated automatically by the layout so that it fits into the layout bounds by setting "autoScale=true "in the constructor of the Layout (which is the default) or if it is set false then the radius parameter comes into play.
Hope that helps - if I miss your point maybe you can clarify
cheers
martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This I ported once from the java prefuse source code, anyway not a big deal. Unfortunately this functionality is not in the flare core yet.
Also if you want to do some more specific things you might consider writing your own layout class. Taking the SpecifiedLayout or the RandomLayout as an example it shouldn't be difficult to see how this is done. And having your own Layout class is of course nice since it keeps things well organized well and you get all the advantages coming along with proper implemented Layout extensions, like animated transitions on visualization update etc.
Also if you think about the ModelViewControler Pattern setting the node position wouldn't be something we want to do while creating the data but more on the level of the view, which would be where the layout is operating, loosely speaking.
Cheers
martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Martin - I think looking at writing my own layout class is a good idea and I might take a shot at it this weekend. Right now I am working on a project that is just an interface prototype, so I've been concerning myself more with what can be mocked up quickly and then we'll worry about implementation when it goes to production and gets re-written. But it sounds like my own layout class might speed up prototyping down the road.
Thanks!
linus
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The thing is it is really bloody straight forward. The only maybe a bit complicated thing if not familiar with it is the usage of the transitioner. Nevertheless the given layouts exemplify it and for me animated transition is just was gives flare its kick ...
Good luck with your project
martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi - I'm a Flare newbie and Actionscript intermediate. I'm working on creating a network topology map using Flare, and right now I'm using the RadialTreeLayout. However, I'd like to be able to provide more absolute positioning. My attempts to edit the NodeSprite's x and y values haven't done anything.
P.S. I also haven't figured out how to change EdgeSprite lengths, if anyone can lead me towards that answer...
Many thanks!
linus
public static function buildNodes(vis:Visualization):void {
var ns:NodeSprite;
//Format label text
var fmt:TextFormat = new TextFormat();
fmt.font = "Arial";
fmt.color = 0x000022;
fmt.size = 11;
fmt.bold = false;
vis.tree.nodes.visit(function(ns:NodeSprite):Boolean {
// Add labels to nodes
var lan:Labeler = new Labeler("data.name",Data.NODES,fmt);
lan.verticalAnchor = 100;
lan.yOffset = 20;
vis.operators.add(lan);
// Add image renderer
ns.renderer = _imageRenderer;
//Position nodes
ns.x = 100; //ideally ns.data.x from GRAPHML
ns.y = 200; //ideally ns.data.y from GRAPHML
return (ns.buttonMode = false);
});
}
Hi Linus,
Are you still using the RadialTreeLayout? That would "override" whatever position you give to your nodes initially.
In regard to the length of Edges, with exception of the ForceDirectedLayout the length of a edge is in general determined by the position of the nodes, so the layout classes position the nodes and the EdgeRenderer draws an edge between connected nodes (the shape of the edge might of course vary and by that the length but that is not your point I guess). In the RadialTreeLayout the distance of the nodes is either calculated automatically by the layout so that it fits into the layout bounds by setting "autoScale=true "in the constructor of the Layout (which is the default) or if it is set false then the radius parameter comes into play.
Hope that helps - if I miss your point maybe you can clarify
cheers
martin
Oh I see, I was under the impression that using one of the pre-defined layout classes was mandatory! This makes much more sense. Thank you!
Hi Linus,
layouts basically just set the nodes somewhere, even so additional functionality might be included.
If you want to set the nodes just according to field values in the data source you might want to use the SpecifiedLayout
http://goosebumps4all.net/34all/bb/showthread.php?tid=131
This I ported once from the java prefuse source code, anyway not a big deal. Unfortunately this functionality is not in the flare core yet.
Also if you want to do some more specific things you might consider writing your own layout class. Taking the SpecifiedLayout or the RandomLayout as an example it shouldn't be difficult to see how this is done. And having your own Layout class is of course nice since it keeps things well organized well and you get all the advantages coming along with proper implemented Layout extensions, like animated transitions on visualization update etc.
Also if you think about the ModelViewControler Pattern setting the node position wouldn't be something we want to do while creating the data but more on the level of the view, which would be where the layout is operating, loosely speaking.
Cheers
martin
Hi Martin - I think looking at writing my own layout class is a good idea and I might take a shot at it this weekend. Right now I am working on a project that is just an interface prototype, so I've been concerning myself more with what can be mocked up quickly and then we'll worry about implementation when it goes to production and gets re-written. But it sounds like my own layout class might speed up prototyping down the road.
Thanks!
linus
The thing is it is really bloody straight forward. The only maybe a bit complicated thing if not familiar with it is the usage of the transitioner. Nevertheless the given layouts exemplify it and for me animated transition is just was gives flare its kick ...
Good luck with your project
martin
Well yeah, it's all about the animated transition. :)