Hi!

In that case you can create a normalizer and use it after all the elements have 
been added. 
For example (__you need to update Roassal since I’ve just fixed a bug__):
-=-=-=-=-=-=-=-=-=
v := RTView new.
data := #((1) (2) (1 2)).
es := data collect: [ :d |
       b := RTPieBuilder new.
       b interaction popupText.
       b objects: d.
       b slice: #value.
       b build.
                b view asElement.
].

v addAll: es.
RTCellLayout new lineItemsCount: 3; on: es.
RTMetricNormalizer new
        view: v; 
        objects: #(1 2);
        distinctColor. 
v
-=-=-=-=-=-=-=-=-=

If you do not know what are the values you have added in, you cannot provide 
“objects: #(1 2)”. In that case, you can simply do:

-=-=-=-=-=-=-=-=-=
v := RTView new.
data := #((1) (2) (1 2)).
es := data collect: [ :d |
       b := RTPieBuilder new.
       b interaction popupText.
       b objects: d.
       b slice: #value.
       b build.
                b view asElement.
].

v addAll: es.
RTCellLayout new lineItemsCount: 3; on: es.
RTMetricNormalizer new
        view: v; 
        elements: v elements;
        distinctColor. 
v
-=-=-=-=-=-=-=-=-=

Let us know how it goes!

Cheers,
Alexandre


> On Mar 18, 2016, at 5:49 PM, Evan Donahue <[email protected]> wrote:
> 
> Hello,
> 
> Many thanks for the reply. This indeed solves part of my problem, and does
> what I expect (although in the smalltalkhub / ObjectProfile / development
> code, only RTView has #asElement, not RTBuilder). Given this, I think I can
> give an example of the real stumbling block I'm facing (although whether it
> is a framework limitation or my own ignorance, I cannot say). 
> 
> Note that in the following code, there are two solid pie charts of the same
> color, but each represents a different object (the numbers 1 and 2
> respectively). This is happening because each pie chart is generated with
> its own normalizer. Is it possible to share a single, global normalizer
> across many pie charts, or set up a single pie builder outside of the loop
> and then only vary its objects? I would like every slice in every pie chart
> that represents the number 1 to be one color, and every slice representing
> the number 2 to be a different color. Which color they are does not matter
> so long as they are distinct, and I will not know ahead of time how many
> different colors I will need or what types of objects I will be
> representing, so I can't manually assign colors to categories.
> 
> v := RTView new.
> data := #((1) (2) (1 2)).
> es := data collect: [ :d |
>        b := RTPieBuilder new.
>        b interaction popupText.
>        b objects: d.
>        b slice: #value.
>        b normalizer distinctColor.
>        b build.
>               b view asElement.
> ].
> 
> v addAll: es.
> RTCellLayout new lineItemsCount: 3; on: es.
> v
> 
> Thank you,
> Evan
> 
> 
> 
> --
> View this message in context: 
> http://forum.world.st/Nesting-Builders-in-Roassal-tp4885185p4885372.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
> 

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




Reply via email to