Hello. I’m trying to use Force based layout to position some elements. I expected to get the image like this.
Using this code http://ws.stfx.eu/LACEUL5X6K1S http://ws.stfx.eu/LACEUL5X6K1S I got something different and I don’t know why.
It looks like all elements attract instead of repel each other. Does somebody know why it is like that?
Best regards, Natalia
2014-11-10 12:17 GMT+01:00 Natalia Tymchuk natalia.tymchuk@unikernel.net:
Hello. I’m trying to use Force based layout to position some elements. I expected to get the image like this. Using this code http://ws.stfx.eu/LACEUL5X6K1S I got something different and I don’t know why.
It looks like all elements attract instead of repel each other. Does somebody know why it is like that?
Best regards, Natalia
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
edge dirven layouts ignore the supplied edges, if the "userDefinedEdges" are set. (maybe it should use " self userDefinedEdges isEmptyNil " instead of " self userDefinedEdges isNil " ) you can force the layout to use your edges with: #useInLayout
| builder |
builder := RTGraphBuilder new.
builder nodes shape: (RTEllipse new ). builder edges connectTo: [ :c | c subclasses ]; useInLayout; "<<-----" shape: (RTLine new color: Color gray). builder addAll: Boolean allSuperclasses, Boolean withAllSubclasses.
builder layout force.
builder build. builder view
As Nicolai said, you need to explicitly say that you want the edges to be considered in the layout using #useInLayout.
Additionally, you may want to play with the charge and length in the layout. Consider the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= builder := RTGraphBuilder new.
builder nodes shape: (RTEllipse new size: 20). builder edges connectTo: [ :c | c subclasses ]; useInLayout; shape: (RTLine new color: Color gray).
builder layout force charge: -300; length: 20.
builder addAll: Boolean allSuperclasses, Boolean withAllSubclasses.
builder build. builder view -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
We give a repulsion of -300 to each node (which is what you want since nodes have to repulse each other), and you give a length of 20 pixel to each edge. You end up with something like:
Cheers, Alexandre
Thank you.
Best regards, Natalia
On Nov 11, 2014, at 3:02 PM, Alexandre Bergel alexandre.bergel@me.com wrote:
As Nicolai said, you need to explicitly say that you want the edges to be considered in the layout using #useInLayout.
Additionally, you may want to play with the charge and length in the layout. Consider the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= builder := RTGraphBuilder new.
builder nodes shape: (RTEllipse new size: 20). builder edges connectTo: [ :c | c subclasses ]; useInLayout; shape: (RTLine new color: Color gray).
builder layout force charge: -300; length: 20.
builder addAll: Boolean allSuperclasses, Boolean withAllSubclasses.
builder build. builder view -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
We give a repulsion of -300 to each node (which is what you want since nodes have to repulse each other), and you give a length of 20 pixel to each edge. You end up with something like: <Screen Shot 2014-11-11 at 11.01.43 AM.png>
Cheers, Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu http://www.bergel.eu/ ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 10, 2014, at 8:17 AM, Natalia Tymchuk <natalia.tymchuk@unikernel.net mailto:natalia.tymchuk@unikernel.net> wrote:
Hello. I’m trying to use Force based layout to position some elements. I expected to get the image like this. <Screen Shot 2014-11-10 at 11.16.54.png> Using this code http://ws.stfx.eu/LACEUL5X6K1S http://ws.stfx.eu/LACEUL5X6K1S I got something different and I don’t know why. <Screen Shot 2014-11-10 at 12.01.11 PM.png> It looks like all elements attract instead of repel each other. Does somebody know why it is like that?
Best regards, Natalia
Moose-dev mailing list Moose-dev@iam.unibe.ch mailto:Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
I played a bit with this code and I I understand that: when I decrease the charge - elements move apart; when I increase the strength - elements move closer to each other; but I don’t understand why when I increase the length - the graph begins to curl. Can you explain this to me please?
Best regards, Natalia
On Nov 11, 2014, at 4:27 PM, Natalia Tymchuk natalia.tymchuk@unikernel.net wrote:
Thank you.
Best regards, Natalia
On Nov 11, 2014, at 3:02 PM, Alexandre Bergel <alexandre.bergel@me.com mailto:alexandre.bergel@me.com> wrote:
As Nicolai said, you need to explicitly say that you want the edges to be considered in the layout using #useInLayout.
Additionally, you may want to play with the charge and length in the layout. Consider the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= builder := RTGraphBuilder new.
builder nodes shape: (RTEllipse new size: 20). builder edges connectTo: [ :c | c subclasses ]; useInLayout; shape: (RTLine new color: Color gray).
builder layout force charge: -300; length: 20.
builder addAll: Boolean allSuperclasses, Boolean withAllSubclasses.
builder build. builder view -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
We give a repulsion of -300 to each node (which is what you want since nodes have to repulse each other), and you give a length of 20 pixel to each edge. You end up with something like: <Screen Shot 2014-11-11 at 11.01.43 AM.png>
Cheers, Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu http://www.bergel.eu/ ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 10, 2014, at 8:17 AM, Natalia Tymchuk <natalia.tymchuk@unikernel.net mailto:natalia.tymchuk@unikernel.net> wrote:
Hello. I’m trying to use Force based layout to position some elements. I expected to get the image like this. <Screen Shot 2014-11-10 at 11.16.54.png> Using this code http://ws.stfx.eu/LACEUL5X6K1S http://ws.stfx.eu/LACEUL5X6K1S I got something different and I don’t know why. <Screen Shot 2014-11-10 at 12.01.11 PM.png> It looks like all elements attract instead of repel each other. Does somebody know why it is like that?
Best regards, Natalia
Moose-dev mailing list Moose-dev@iam.unibe.ch mailto:Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch mailto:Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
I guess this is because nodes are far for each other. They are like magnets, and edges are like springs. I hope this helps.
Alexandre
Le 11-11-2014 à 18:07, Natalia Tymchuk natalia.tymchuk@unikernel.net a écrit :
I played a bit with this code and I I understand that: when I decrease the charge - elements move apart; when I increase the strength - elements move closer to each other; but I don’t understand why when I increase the length - the graph begins to curl. Can you explain this to me please?
Best regards, Natalia
On Nov 11, 2014, at 4:27 PM, Natalia Tymchuk natalia.tymchuk@unikernel.net wrote:
Thank you.
Best regards, Natalia
On Nov 11, 2014, at 3:02 PM, Alexandre Bergel alexandre.bergel@me.com wrote:
As Nicolai said, you need to explicitly say that you want the edges to be considered in the layout using #useInLayout.
Additionally, you may want to play with the charge and length in the layout. Consider the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= builder := RTGraphBuilder new.
builder nodes shape: (RTEllipse new size: 20). builder edges connectTo: [ :c | c subclasses ]; useInLayout; shape: (RTLine new color: Color gray).
builder layout force charge: -300; length: 20.
builder addAll: Boolean allSuperclasses, Boolean withAllSubclasses.
builder build. builder view -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
We give a repulsion of -300 to each node (which is what you want since nodes have to repulse each other), and you give a length of 20 pixel to each edge. You end up with something like: <Screen Shot 2014-11-11 at 11.01.43 AM.png>
Cheers, Alexandre
-- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Nov 10, 2014, at 8:17 AM, Natalia Tymchuk natalia.tymchuk@unikernel.net wrote:
Hello. I’m trying to use Force based layout to position some elements. I expected to get the image like this. <Screen Shot 2014-11-10 at 11.16.54.png> Using this code http://ws.stfx.eu/LACEUL5X6K1S I got something different and I don’t know why. <Screen Shot 2014-11-10 at 12.01.11 PM.png> It looks like all elements attract instead of repel each other. Does somebody know why it is like that?
Best regards, Natalia
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev