Hi,
I made a couple of changes of the builder as per your suggestions. An updated usage script
would be:
builder := DFTreeMapBuilder new.
builder weightBlock: [ :el | el ].
builder nodes: (1 to: 50).
builder nestingFromAssociations: (builder nodes allButFirst collect: [:each | (each // 2)
-> each ]).
"Some optional configurations parameters"
colors := Color green mix: Color blue shades: (builder nodes size).
builder colorBlock: [ :el | colors at: el ].
builder rootColor: ((Color red) alpha: 0.5).
builder inset: 5.
builder extent: 300@400.
builder origin: 10@30.
"Some node-specific customization"
builder fillNodes: [ :n | (n > 40) ] withColor: (Color white).
builder fillNode: 50 withColor: (Color yellow).
builder fillNode: 43 withColor: (Color green).
builder strokeNodes: [ :n | (n \\ 2) = 1 ] withColor: (Color blue).
builder strokeNode: 13 withColor: (Color black).
builder strokeNodes: [ :n | (n \\ 6) = 0 ] withWidth: 2.
builder strokeNode: 3 withColor: (Color red).
builder strokeNode: 3 withWidth: 3.
"Using the #drawOn: message for compatibility with ROMondrianViewBuilder"
view := ROView new.
view @ RODraggable.
builder drawOn: view.
view open.
And the resulting tree map @
https://dl.dropboxusercontent.com/u/6281855/updated-treemap.png
Now I am converting from z-ordering to nesting. Stay tuned ;)
Cheers,
Roby
On Oct 7, 2013, at 7:33 PM, Alexandre Bergel <alexandre.bergel(a)me.com> wrote:
Looks good to me.
Maybe you could have in addition to
DFTreeMapBuilder>>associations:
something
DFTreeMapBuilder>>parent: aBlockOrASymbol
Also, something very important that I forgot to mention, we need a method
DFTreeMapBuilder>>drawOn: aROView
Like that, we should be able to have a treemap when using the mondrian builder. Using
your example, we should have exactly the same result if we do:
-=-=-=-=-=-=-=-=-=-=-=-=
builder := DFTreeMapBuilder new.
builder ... // your example here
view := ROView new.
builder drawOn: view.
view open
-=-=-=-=-=-=-=-=-=-=-=-=
Cheers,
Alexandre
On Oct 7, 2013, at 1:07 PM, "roberto.minelli(a)usi.ch"
<roberto.minelli(a)usi.ch> wrote:
Hi,
I finished the first version of the new tree map builder for Roassal.
You can find the source code in my SmalltalkHub package 'DevFlow-View'!
Gofer new
smalltalkhubUser: 'RobertoMinelli' project: 'DevFlow';
package: 'DevFlow-View';
load.
Here's an example usage:
builder := DFTreeMapBuilder new.
builder weightBlock: [ :el | el ].
builder nodes: (1 to: 50).
builder associations: (builder nodes allButFirst collect: [:each | (each // 2) -> each
]).
"Some optional configurations parameters"
colors := Color white mix: Color blue shades: (builder nodes size).
builder colorBlock: [ :el | colors at: el ].
builder rootColor: ((Color red) alpha: 0.5).
builder inset: 5.
builder extent: 500@300.
builder origin: 10@30.
builder draw.
And the resulting tree map!
[cid:EC2669CC-CA97-4B81-8B1B-B792FBE1C04F@mobile.usilu.net]
Please tell me what do you think!
The next steps are:
- Add customizable interactions
- Remove z-ordering and use proper nesting
- Eventually unroll the recursion in the layout algorithm
Cheers,
Roberto
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel
http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.