Dynamically adding nodes to Roassal

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamically adding nodes to Roassal

roberto.minelli@usi.ch
Hi,

I am playing around with Roassal (in particular, a tree map) and I have a question: Is there a way to dynamically adding nodes? I mean, once the view is generated to update the #nodes by adding a new node (and associations as well, i.e., edges) and have the visualization re-

At the moment I managed to have something *almost* working, but the behavior of the ROTreeMapLayout is not clear to me.

Using the ROMondrianViewBuilder I can specify the size of the Tree map, but then I am not able to dynamically add nodes. Well, at least I did not manage to do that. So I moved to pure Roassal, as suggested by Alejandro.

Here's how my actual code looks like: http://ws.stfx.eu/CFM522Z9X3ES

I am a beginner with Roassal, so I spend some time to figure out how to draw the tree map in this way. I did not really quite understand why I have to add the ROBox new size: 200 to the ROElement, but I'll figure it out.

The thing is when I try to add the new node. Following, again, Alejandro's advice I am writing something like:

"I add a new node, re-layout the view, and signalUpdate"
rawView add: ((ROElement on: 10) + (ROBox new size: 200)).
(ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: rawView elements.
rawView signalUpdate .

The result is quite strange, the view is indeed updated but I cannot understand why all sizes are messed up.

I think that once I apply the layout, the "elements" array is actually changed (i.e., sizes, parents, resize strategy). Am I correct? is it the correct behavior?

My questions, in short are: How can I fix the overall size of the tree map? Am I doing everything correct till now?

Thanks again for your help,
Roby
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically adding nodes to Roassal

abergel
Hi Roberto,

First of all, I really would like to thank you for your email. This kind of emails are really important for improving Roassal.

I have solved your problem. Check this video: https://vimeo.com/75820243

Even though the solution is quite ad-hoc, I think you can play with it. Consider the following examples:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"View"
| view elements stack t running |
view := ROView new.
view @ RODraggable.

"Stack, useful to have a menu"
stack := ROViewStack new.
stack addView: view.
t := 0.
running := nil.
stack addMenu: '+1' callBack: [ :evt |
        t := t + 1.
        view elementsDo: #remove.
       
        elements := (ROElement forCollection: (1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  ].
        view addAll: elements.

        running := view elements first.
        view elements allButFirst do: [ :el |
                view add: (ROEdge lineFrom: running to: el).
                running := el.
        ].
" ROHorizontalLineLayout on: view elements.
" (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: elements.
].
stack open.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"View"
| view elements stack t classes |
view := ROView new.
view @ RODraggable.

"We prepare the data"
classes := ROShape withAllSubclasses asSortedCollection: [ :c1 :c2 | c1 name < c2 name ].
t := 0.

"Stack, useful to have a menu"
stack := ROViewStack new.
stack addView: view.


stack addMenu: '+1' callBack: [ :evt |
        "Increment the amount of classes found in the visualization"
        t := t + 1.
       
        "We clean the view"
        view elementsDo: #remove.
       
        elements := (ROElement forCollection: (classes copyFrom: 1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  @ ROPopup ].
        view addAll: elements.

        view elements allButFirst do: [ :el |
                view addAll: (ROEdge buildEdgesFromElements: elements from: #superclass to: #yourself).
        ].
" ROTreeLayout on: view elementsNotEdge edges: view elementsAsEdge.
" (ROTreeMapLayout withWeightBlock: [ :e | e model numberOfLinesOfCode]) applyOn: elements.
        view signalUpdate.
].
stack open.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Alexandre


On Sep 30, 2013, at 4:21 AM, [hidden email] wrote:

> Hi,
>
> I am playing around with Roassal (in particular, a tree map) and I have a question: Is there a way to dynamically adding nodes? I mean, once the view is generated to update the #nodes by adding a new node (and associations as well, i.e., edges) and have the visualization re-
>
> At the moment I managed to have something *almost* working, but the behavior of the ROTreeMapLayout is not clear to me.
>
> Using the ROMondrianViewBuilder I can specify the size of the Tree map, but then I am not able to dynamically add nodes. Well, at least I did not manage to do that. So I moved to pure Roassal, as suggested by Alejandro.
>
> Here's how my actual code looks like: http://ws.stfx.eu/CFM522Z9X3ES
>
> I am a beginner with Roassal, so I spend some time to figure out how to draw the tree map in this way. I did not really quite understand why I have to add the ROBox new size: 200 to the ROElement, but I'll figure it out.
>
> The thing is when I try to add the new node. Following, again, Alejandro's advice I am writing something like:
>
> "I add a new node, re-layout the view, and signalUpdate"
> rawView add: ((ROElement on: 10) + (ROBox new size: 200)).
> (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: rawView elements.
> rawView signalUpdate .
>
> The result is quite strange, the view is indeed updated but I cannot understand why all sizes are messed up.
>
> I think that once I apply the layout, the "elements" array is actually changed (i.e., sizes, parents, resize strategy). Am I correct? is it the correct behavior?
>
> My questions, in short are: How can I fix the overall size of the tree map? Am I doing everything correct till now?
>
> Thanks again for your help,
> Roby
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically adding nodes to Roassal

Tudor Girba-2


On Tue, Oct 1, 2013 at 12:41 AM, Alexandre Bergel <[hidden email]> wrote:
Hi Roberto,

First of all, I really would like to thank you for your email. This kind of emails are really important for improving Roassal.

I have solved your problem. Check this video: https://vimeo.com/75820243

Even though the solution is quite ad-hoc, I think you can play with it. Consider the following examples:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"View"
| view elements stack t running |
view := ROView new.
view @ RODraggable.

"Stack, useful to have a menu"
stack := ROViewStack new.
stack addView: view.
t := 0.
running := nil.
stack addMenu: '+1' callBack: [ :evt |
        t := t + 1.
        view elementsDo: #remove.

        elements := (ROElement forCollection: (1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  ].
        view addAll: elements.

        running := view elements first.
        view elements allButFirst do: [ :el |
                view add: (ROEdge lineFrom: running to: el).
                running := el.
        ].
"       ROHorizontalLineLayout on: view elements.
"       (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: elements.
].
stack open.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
"View"
| view elements stack t classes |
view := ROView new.
view @ RODraggable.

"We prepare the data"
classes := ROShape withAllSubclasses asSortedCollection: [ :c1 :c2 | c1 name < c2 name ].
t := 0.

"Stack, useful to have a menu"
stack := ROViewStack new.
stack addView: view.


stack addMenu: '+1' callBack: [ :evt |
        "Increment the amount of classes found in the visualization"
        t := t + 1.

        "We clean the view"
        view elementsDo: #remove.

        elements := (ROElement forCollection: (classes copyFrom: 1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  @ ROPopup ].
        view addAll: elements.

        view elements allButFirst do: [ :el |
                view addAll: (ROEdge buildEdgesFromElements: elements from: #superclass to: #yourself).
        ].
"       ROTreeLayout on: view elementsNotEdge edges: view elementsAsEdge.
"       (ROTreeMapLayout withWeightBlock: [ :e | e model numberOfLinesOfCode]) applyOn: elements.
        view signalUpdate.
].
stack open.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Alexandre


On Sep 30, 2013, at 4:21 AM, [hidden email] wrote:

> Hi,
>
> I am playing around with Roassal (in particular, a tree map) and I have a question: Is there a way to dynamically adding nodes? I mean, once the view is generated to update the #nodes by adding a new node (and associations as well, i.e., edges) and have the visualization re-
>
> At the moment I managed to have something *almost* working, but the behavior of the ROTreeMapLayout is not clear to me.
>
> Using the ROMondrianViewBuilder I can specify the size of the Tree map, but then I am not able to dynamically add nodes. Well, at least I did not manage to do that. So I moved to pure Roassal, as suggested by Alejandro.
>
> Here's how my actual code looks like: http://ws.stfx.eu/CFM522Z9X3ES
>
> I am a beginner with Roassal, so I spend some time to figure out how to draw the tree map in this way. I did not really quite understand why I have to add the ROBox new size: 200 to the ROElement, but I'll figure it out.
>
> The thing is when I try to add the new node. Following, again, Alejandro's advice I am writing something like:
>
> "I add a new node, re-layout the view, and signalUpdate"
> rawView add: ((ROElement on: 10) + (ROBox new size: 200)).
> (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: rawView elements.
> rawView signalUpdate .
>
> The result is quite strange, the view is indeed updated but I cannot understand why all sizes are messed up.
>
> I think that once I apply the layout, the "elements" array is actually changed (i.e., sizes, parents, resize strategy). Am I correct? is it the correct behavior?
>
> My questions, in short are: How can I fix the overall size of the tree map? Am I doing everything correct till now?
>
> Thanks again for your help,
> Roby
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically adding nodes to Roassal

roberto.minelli@usi.ch
In reply to this post by abergel
Cool Alex! I will take a look at your solution now!

Cheers,
R

On Oct 1, 2013, at 12:41 AM, Alexandre Bergel <[hidden email]>
 wrote:

> Hi Roberto,
>
> First of all, I really would like to thank you for your email. This kind of emails are really important for improving Roassal.
>
> I have solved your problem. Check this video: https://vimeo.com/75820243
>
> Even though the solution is quite ad-hoc, I think you can play with it. Consider the following examples:
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> "View"
> | view elements stack t running |
> view := ROView new.
> view @ RODraggable.
>
> "Stack, useful to have a menu"
> stack := ROViewStack new.
> stack addView: view.
> t := 0.
> running := nil.
> stack addMenu: '+1' callBack: [ :evt |
> t := t + 1.
> view elementsDo: #remove.
>
> elements := (ROElement forCollection: (1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  ].
> view addAll: elements.
>
> running := view elements first.
> view elements allButFirst do: [ :el |
> view add: (ROEdge lineFrom: running to: el).
> running := el.
> ].
> " ROHorizontalLineLayout on: view elements.
> " (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: elements.
> ].
> stack open.
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> "View"
> | view elements stack t classes |
> view := ROView new.
> view @ RODraggable.
>
> "We prepare the data"
> classes := ROShape withAllSubclasses asSortedCollection: [ :c1 :c2 | c1 name < c2 name ].
> t := 0.
>
> "Stack, useful to have a menu"
> stack := ROViewStack new.
> stack addView: view.
>
>
> stack addMenu: '+1' callBack: [ :evt |
> "Increment the amount of classes found in the visualization"
> t := t + 1.
>
> "We clean the view"
> view elementsDo: #remove.
>
> elements := (ROElement forCollection: (classes copyFrom: 1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  @ ROPopup ].
> view addAll: elements.
>
> view elements allButFirst do: [ :el |
> view addAll: (ROEdge buildEdgesFromElements: elements from: #superclass to: #yourself).
> ].
> " ROTreeLayout on: view elementsNotEdge edges: view elementsAsEdge.
> " (ROTreeMapLayout withWeightBlock: [ :e | e model numberOfLinesOfCode]) applyOn: elements.
> view signalUpdate.
> ].
> stack open.
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
> Alexandre
>
>
> On Sep 30, 2013, at 4:21 AM, [hidden email] wrote:
>
>> Hi,
>>
>> I am playing around with Roassal (in particular, a tree map) and I have a question: Is there a way to dynamically adding nodes? I mean, once the view is generated to update the #nodes by adding a new node (and associations as well, i.e., edges) and have the visualization re-
>>
>> At the moment I managed to have something *almost* working, but the behavior of the ROTreeMapLayout is not clear to me.
>>
>> Using the ROMondrianViewBuilder I can specify the size of the Tree map, but then I am not able to dynamically add nodes. Well, at least I did not manage to do that. So I moved to pure Roassal, as suggested by Alejandro.
>>
>> Here's how my actual code looks like: http://ws.stfx.eu/CFM522Z9X3ES
>>
>> I am a beginner with Roassal, so I spend some time to figure out how to draw the tree map in this way. I did not really quite understand why I have to add the ROBox new size: 200 to the ROElement, but I'll figure it out.
>>
>> The thing is when I try to add the new node. Following, again, Alejandro's advice I am writing something like:
>>
>> "I add a new node, re-layout the view, and signalUpdate"
>> rawView add: ((ROElement on: 10) + (ROBox new size: 200)).
>> (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: rawView elements.
>> rawView signalUpdate .
>>
>> The result is quite strange, the view is indeed updated but I cannot understand why all sizes are messed up.
>>
>> I think that once I apply the layout, the "elements" array is actually changed (i.e., sizes, parents, resize strategy). Am I correct? is it the correct behavior?
>>
>> My questions, in short are: How can I fix the overall size of the tree map? Am I doing everything correct till now?
>>
>> Thanks again for your help,
>> Roby
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically adding nodes to Roassal

roberto.minelli@usi.ch
Again, thanks Alex. Your solution works like a charm.

I have another question for you…

Please check this video: https://dl.dropboxusercontent.com/u/6281855/RoassalUpdate.m4v
Do you think this behavior is normal?

This is a static tree map, nothing strange.
I create a ROView, assign on click interactions, set the view nodes, edges, layout the view and open the view.

As you can see, when the tree map is generated some nodes are not displayed, then when I resize the window, or drag the view, all the nodes appear magically. Any intuition?

Cheers,
R

On Oct 1, 2013, at 9:54 AM, [hidden email] wrote:

> Cool Alex! I will take a look at your solution now!
>
> Cheers,
> R
>
> On Oct 1, 2013, at 12:41 AM, Alexandre Bergel <[hidden email]>
> wrote:
>
>> Hi Roberto,
>>
>> First of all, I really would like to thank you for your email. This kind of emails are really important for improving Roassal.
>>
>> I have solved your problem. Check this video: https://vimeo.com/75820243
>>
>> Even though the solution is quite ad-hoc, I think you can play with it. Consider the following examples:
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> "View"
>> | view elements stack t running |
>> view := ROView new.
>> view @ RODraggable.
>>
>> "Stack, useful to have a menu"
>> stack := ROViewStack new.
>> stack addView: view.
>> t := 0.
>> running := nil.
>> stack addMenu: '+1' callBack: [ :evt |
>> t := t + 1.
>> view elementsDo: #remove.
>>
>> elements := (ROElement forCollection: (1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  ].
>> view addAll: elements.
>>
>> running := view elements first.
>> view elements allButFirst do: [ :el |
>> view add: (ROEdge lineFrom: running to: el).
>> running := el.
>> ].
>> " ROHorizontalLineLayout on: view elements.
>> " (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: elements.
>> ].
>> stack open.
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> "View"
>> | view elements stack t classes |
>> view := ROView new.
>> view @ RODraggable.
>>
>> "We prepare the data"
>> classes := ROShape withAllSubclasses asSortedCollection: [ :c1 :c2 | c1 name < c2 name ].
>> t := 0.
>>
>> "Stack, useful to have a menu"
>> stack := ROViewStack new.
>> stack addView: view.
>>
>>
>> stack addMenu: '+1' callBack: [ :evt |
>> "Increment the amount of classes found in the visualization"
>> t := t + 1.
>>
>> "We clean the view"
>> view elementsDo: #remove.
>>
>> elements := (ROElement forCollection: (classes copyFrom: 1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  @ ROPopup ].
>> view addAll: elements.
>>
>> view elements allButFirst do: [ :el |
>> view addAll: (ROEdge buildEdgesFromElements: elements from: #superclass to: #yourself).
>> ].
>> " ROTreeLayout on: view elementsNotEdge edges: view elementsAsEdge.
>> " (ROTreeMapLayout withWeightBlock: [ :e | e model numberOfLinesOfCode]) applyOn: elements.
>> view signalUpdate.
>> ].
>> stack open.
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>
>>
>> Alexandre
>>
>>
>> On Sep 30, 2013, at 4:21 AM, [hidden email] wrote:
>>
>>> Hi,
>>>
>>> I am playing around with Roassal (in particular, a tree map) and I have a question: Is there a way to dynamically adding nodes? I mean, once the view is generated to update the #nodes by adding a new node (and associations as well, i.e., edges) and have the visualization re-
>>>
>>> At the moment I managed to have something *almost* working, but the behavior of the ROTreeMapLayout is not clear to me.
>>>
>>> Using the ROMondrianViewBuilder I can specify the size of the Tree map, but then I am not able to dynamically add nodes. Well, at least I did not manage to do that. So I moved to pure Roassal, as suggested by Alejandro.
>>>
>>> Here's how my actual code looks like: http://ws.stfx.eu/CFM522Z9X3ES
>>>
>>> I am a beginner with Roassal, so I spend some time to figure out how to draw the tree map in this way. I did not really quite understand why I have to add the ROBox new size: 200 to the ROElement, but I'll figure it out.
>>>
>>> The thing is when I try to add the new node. Following, again, Alejandro's advice I am writing something like:
>>>
>>> "I add a new node, re-layout the view, and signalUpdate"
>>> rawView add: ((ROElement on: 10) + (ROBox new size: 200)).
>>> (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: rawView elements.
>>> rawView signalUpdate .
>>>
>>> The result is quite strange, the view is indeed updated but I cannot understand why all sizes are messed up.
>>>
>>> I think that once I apply the layout, the "elements" array is actually changed (i.e., sizes, parents, resize strategy). Am I correct? is it the correct behavior?
>>>
>>> My questions, in short are: How can I fix the overall size of the tree map? Am I doing everything correct till now?
>>>
>>> Thanks again for your help,
>>> Roby
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Dynamically adding nodes to Roassal

abergel
Hi!

> Again, thanks Alex. Your solution works like a charm.

Thanks

> I have another question for you…
>
> Please check this video: https://dl.dropboxusercontent.com/u/6281855/RoassalUpdate.m4v
> Do you think this behavior is normal?

No. I have seen this already. I am not sure why this happens.
Can you have a simple example to reproduce the problem? If no, then can I have access to your image?

Cheers,
Alexandre


>
> This is a static tree map, nothing strange.
> I create a ROView, assign on click interactions, set the view nodes, edges, layout the view and open the view.
>
> As you can see, when the tree map is generated some nodes are not displayed, then when I resize the window, or drag the view, all the nodes appear magically. Any intuition?
>
> Cheers,
> R
>
> On Oct 1, 2013, at 9:54 AM, [hidden email] wrote:
>
>> Cool Alex! I will take a look at your solution now!
>>
>> Cheers,
>> R
>>
>> On Oct 1, 2013, at 12:41 AM, Alexandre Bergel <[hidden email]>
>> wrote:
>>
>>> Hi Roberto,
>>>
>>> First of all, I really would like to thank you for your email. This kind of emails are really important for improving Roassal.
>>>
>>> I have solved your problem. Check this video: https://vimeo.com/75820243
>>>
>>> Even though the solution is quite ad-hoc, I think you can play with it. Consider the following examples:
>>>
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>> "View"
>>> | view elements stack t running |
>>> view := ROView new.
>>> view @ RODraggable.
>>>
>>> "Stack, useful to have a menu"
>>> stack := ROViewStack new.
>>> stack addView: view.
>>> t := 0.
>>> running := nil.
>>> stack addMenu: '+1' callBack: [ :evt |
>>> t := t + 1.
>>> view elementsDo: #remove.
>>>
>>> elements := (ROElement forCollection: (1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  ].
>>> view addAll: elements.
>>>
>>> running := view elements first.
>>> view elements allButFirst do: [ :el |
>>> view add: (ROEdge lineFrom: running to: el).
>>> running := el.
>>> ].
>>> " ROHorizontalLineLayout on: view elements.
>>> " (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: elements.
>>> ].
>>> stack open.
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>>
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>> "View"
>>> | view elements stack t classes |
>>> view := ROView new.
>>> view @ RODraggable.
>>>
>>> "We prepare the data"
>>> classes := ROShape withAllSubclasses asSortedCollection: [ :c1 :c2 | c1 name < c2 name ].
>>> t := 0.
>>>
>>> "Stack, useful to have a menu"
>>> stack := ROViewStack new.
>>> stack addView: view.
>>>
>>>
>>> stack addMenu: '+1' callBack: [ :evt |
>>> "Increment the amount of classes found in the visualization"
>>> t := t + 1.
>>>
>>> "We clean the view"
>>> view elementsDo: #remove.
>>>
>>> elements := (ROElement forCollection: (classes copyFrom: 1 to: t)) collect: [:e | e + (ROBorder gray size: 200) + ROBox  @ ROPopup ].
>>> view addAll: elements.
>>>
>>> view elements allButFirst do: [ :el |
>>> view addAll: (ROEdge buildEdgesFromElements: elements from: #superclass to: #yourself).
>>> ].
>>> " ROTreeLayout on: view elementsNotEdge edges: view elementsAsEdge.
>>> " (ROTreeMapLayout withWeightBlock: [ :e | e model numberOfLinesOfCode]) applyOn: elements.
>>> view signalUpdate.
>>> ].
>>> stack open.
>>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>>>
>>>
>>> Alexandre
>>>
>>>
>>> On Sep 30, 2013, at 4:21 AM, [hidden email] wrote:
>>>
>>>> Hi,
>>>>
>>>> I am playing around with Roassal (in particular, a tree map) and I have a question: Is there a way to dynamically adding nodes? I mean, once the view is generated to update the #nodes by adding a new node (and associations as well, i.e., edges) and have the visualization re-
>>>>
>>>> At the moment I managed to have something *almost* working, but the behavior of the ROTreeMapLayout is not clear to me.
>>>>
>>>> Using the ROMondrianViewBuilder I can specify the size of the Tree map, but then I am not able to dynamically add nodes. Well, at least I did not manage to do that. So I moved to pure Roassal, as suggested by Alejandro.
>>>>
>>>> Here's how my actual code looks like: http://ws.stfx.eu/CFM522Z9X3ES
>>>>
>>>> I am a beginner with Roassal, so I spend some time to figure out how to draw the tree map in this way. I did not really quite understand why I have to add the ROBox new size: 200 to the ROElement, but I'll figure it out.
>>>>
>>>> The thing is when I try to add the new node. Following, again, Alejandro's advice I am writing something like:
>>>>
>>>> "I add a new node, re-layout the view, and signalUpdate"
>>>> rawView add: ((ROElement on: 10) + (ROBox new size: 200)).
>>>> (ROTreeMapLayout withWeightBlock: [ :e | e model ]) applyOn: rawView elements.
>>>> rawView signalUpdate .
>>>>
>>>> The result is quite strange, the view is indeed updated but I cannot understand why all sizes are messed up.
>>>>
>>>> I think that once I apply the layout, the "elements" array is actually changed (i.e., sizes, parents, resize strategy). Am I correct? is it the correct behavior?
>>>>
>>>> My questions, in short are: How can I fix the overall size of the tree map? Am I doing everything correct till now?
>>>>
>>>> Thanks again for your help,
>>>> Roby
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> [hidden email]
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>> --
>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>> Alexandre Bergel  http://www.bergel.eu
>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> [hidden email]
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev