Hi,
We're in our local Open Data Day hackathon, creating a treemap to visualize public spending. We have cleaned the dataset and made some queries to zoom into the info we're interested in. So far, so good, but now we would like to change the labels on a treemap. So consider this code: ============= | b labels | b := RTTreeMapBuilder new. labels := #('uno' 'dos' 'tres' 'cuatro' 'cinco'). b shape fillColor: Color random. b from: (1 to: 5) using: [#()]. b weight: [:n | n]. b build. ^ b view. ============= How can I add the labels from labels to each of shapes of b? Thanks, Offray |
I am not in front of my computer:
B view elements @ RTLabelled I think it should do it Alexandre > Le 5 mars 2016 à 19:44, Offray Vladimir Luna Cárdenas <[hidden email]> a écrit : > > Hi, > > We're in our local Open Data Day hackathon, creating a treemap to visualize public spending. We have cleaned the dataset and made some queries to zoom into the info we're interested in. So far, so good, but now we would like to change the labels on a treemap. So consider this code: > > ============= > | b labels | > b := RTTreeMapBuilder new. > labels := #('uno' 'dos' 'tres' 'cuatro' 'cinco'). > b shape fillColor: Color random. > b from: (1 to: 5) using: [#()]. > b weight: [:n | n]. > b build. > ^ b view. > ============= > > How can I add the labels from labels to each of shapes of b? > > Thanks, > > Offray > |
Thanks Alexandre, even more being away of the computer... It kind of
works. Now the visualization shows the labels in the upper side of
each rectangle. Like this:
The idea is to put labels like "uno", "dos", "tres", "cuatro", "cinco" on each rectagle instead of the numbers. Anyway we have ended our hackathon/workshop in the #DataWeek3 and #OpenDataDay for today. A really good balance and this third edition is the best of all until now. Still there is a step learning curve and "cultural shock" on Smalltalk, but agile visualization, the Roassal environment, GT Tools, and Pharo are promising and interesting for newcomers. Cheers and thanks again, Offray On 05/03/16 20:42, Alexandre Bergel
wrote:
B view elements @ RTLabelled |
Almost there!
=========== | b labels popup | labels := #('uno' 'dos' 'tres' 'cuatro' 'cinco'). popup := RTPopup new. popup text: [:object | labels at: object ]. b := RTTreeMapBuilder new. b shape fillColor: Color random. b from: (1 to: 5) using: [#()]. b weight: [:n | n]. b build. b view elements @ popup. ^ b view. =========== The strange thing is that 2nd and 3rd boxes don't get the proper label, but everyone else does.... Cheers, Offray On 05/03/16 20:56, Offray Vladimir Luna
Cárdenas wrote:
Thanks Alexandre, even more being away of the computer... It kind of works. Now the visualization shows the labels in the upper side of each rectangle. Like this: |
You can do something like that:
b := RTTreeMapBuilder new. labels := #('uno' 'dos' 'tres' 'cuatro' 'cinco'). b shape fillColor: Color veryLightGray. b from: (1 to: 5) using: [#()]. b weight: [:n | n]. b build. b view elements @ (RTLabelled new color: Color black; center). ^ b view. Let me know how it goes! Cheers, Alexandre On Mar 5, 2016, at 11:28 PM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote: -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. |
Thanks Alexandre. Your code lead me to the following, which solves
the issue:
=============== | boxedLabels b labels | b := RTTreeMapBuilder new. labels := #('uno' 'dos' 'tres' 'cuatro' 'cinco'). boxedLabels := (RTLabelled new color: Color black; center). boxedLabels text: [:index | labels at: index ]. b shape fillColor: Color veryLightGray. b from: (1 to: 5) using: [#()]. b weight: [:n | n]. b build. b view elements @ boxedLabels. ^ b view. =============== Cheers, Offray On 06/03/16 13:58, Alexandre Bergel
wrote:
You can do something like that: |
Free forum by Nabble | Edit this page |