Posted by
abergel on
Nov 23, 2014; 10:59pm
URL: https://forum.world.st/Named-edges-and-nodes-in-a-Roassal-graph-tp4791772p4791850.html
Hi Offray,
The chapter about Roassal contains several examples on how to name nodes:
https://dl.dropboxusercontent.com/u/31543901/AgileVisualization/Roassal/0104-Roassal.html
To label the nodes, the simplest way is to use @ RTLabelled. (However, you need first to add the element in the view before doing @ RTLabelled). This works pretty well. Here is your code:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"Definimo los elementos, que denominamos simplemente e1, e2, etc, con
su color y su tamaño"
e1 := (RTEllipse new color: (Color blue alpha: 0.4); size: 20) elementOn: 'hello'.
e2 := (RTEllipse new color: (Color red alpha: 0.4); size: 20) elementOn: 'Bonjour'.
e3 := (RTEllipse new color: (Color yellow alpha: 0.4); size: 20) elementOn: 'Gutten Tag'.
e4 := (RTEllipse new color: (Color green alpha: 0.4); size: 20) elementOn: 'BuenGiorno'.
"Adicionamos los elementos a la vista"
vista add: e1; add: e2; add: e3; add: e4.
"Decimos que los elementos antes definidos se podrán arrastrar"
e1 @ RTDraggable @ RTLabelled.
e2 @ RTDraggable @ RTLabelled.
e3 @ RTDraggable @ RTLabelled.
e4 @ RTDraggable @ RTLabelled.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
You have something like that:
For the edges, you can simply use @RTLabelled on an edge.
Consider:
-=-=-=-=-=-=-=-=-=-=-=-=
line1 := line edgeFrom: e1 to: e2.
line2 := line edgeFrom: e2 to: e1.
line3 := line edgeFrom: e1 to: e2.
line4 := line edgeFrom: e2 to: e2.
line5 := line edgeFrom: e3 to: e4.
vista add: line1.
vista add: line2.
vista add: line3.
vista add: line4.
vista add: line5.
line1 @ RTLabelled.
line2 @ RTLabelled.
line3 @ RTLabelled.
line4 @ RTLabelled.
line5 @ RTLabelled.
-=-=-=-=-=-=-=-=-=-=-=-=
You can particularize the edge label with something like: line1 @ (RTLabelled new text: 'my edge').
Cheers,
Alexandre
On Nov 22, 2014, at 6:33 PM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote:
Hi all.
We're now in a small workshop about data narratives and I'm showing some people Roassal.
I would like to have named nodes and edges in a graph. I have created a small understable graph from the object profile gallery here: http://ws.stfx.eu/8QMELFJ4V370
Anyone knows how to add names to edges and nodes in this graph?
If I could have a quick answer on this one would be awesome. By the way I'm now 5:50 pm (GMT-5) in the pharo irc channel is someone pops up.
Thanks,
Offray
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.