Thank you Alex for Pie chart support in Charter.


On Sun, Aug 3, 2014 at 3:10 AM, Alexandre Bergel <alexandre.bergel@me.com> wrote:
Hi Hernán,

I did a bit of programming today and did a PieBuilder. Here are some example:
-=-=-=-=-=-=-=-=-=
b := RTPieBuilder new.
b interaction popup.
b objects: RTShape withAllSubclasses.
b slice: #numberOfMethods.
b globalRule distinctColor.
b labelledIf: [ :c | c numberOfMethods > 18 ].
b view
-=-=-=-=-=-=-=-=-=


-=-=-=-=-=-=-=-=-=
| b |
b := RTPieBuilder new.
b interaction popup.
b objects: (Array with: Dictionary with: Collection with: Set with: OrderedCollection ).
b slice: #numberOfMethods.
b globalRule distinctColor.
b labelled.
b emphasize: Set by: 20.
b emphasize: Dictionary by: 20.
b open.
-=-=-=-=-=-=-=-=-=


Some example have been added to the Roassal example browser, available from the World menu.


This is just a beginning. I made these example without a clear scenario in mind. If you come with a specific need, probably you will be able to adjust the PieBuilder. For example, you may want to particularize the position of the labeling

Cheers,
Alexandre


On Jul 28, 2014, at 6:29 PM, Hernán Morales Durand <hernan.morales@gmail.com> wrote:

Thanks Alex,

I did not finished reading the chapter about RTBuilder yet. But regardless of the GraphET2 scope, having a pie diagram builder is important for Pharo (I don't know the status of PieChartMorph but I will check). 

I have tried two different directions. One is adding a RTLabel to each sector shape in #getElementsFromModels

GET2PieDiagram>>getElementsFromModels

   ...
            label := RTLabel new text: model key.
            shape := shape + label.
   ...

| diag |
diag := GET2DiagramBuilder new.
(diag pieDiagram) 
    function: #value;
    models: {'A' -> 30 . 'B' -> 10 . 'C' -> 20 . 'D' -> 40};
    color: [ Color random ].
^ diag open.


Another one is using #modelLabels: to add labels to axis:

| diag |
diag := GET2DiagramBuilder new.
(diag pieDiagram) 
    modelLabels: #key;
    function: #value;
    models: {'A' -> 30 . 'B' -> 10 . 'C' -> 20 . 'D' -> 40};
    color: [ Color random ].
^ diag open.

but none of them positions the labels nicely. If anyone wants to comment would be very welcome :)
Cheers,

Hernán




2014-07-26 14:14 GMT-03:00 Alexandre Bergel <alexandre.bergel@me.com>:
Hi Hernán,

Thanks for your effort. This is very valuable.
However, I am not sure a pie diagram should be part of GraphET. A pie is radically different from a curve. Maybe subclassing the class RTBuilder is the way to go. You will then not be constraint by GraphET for the labeling...

Cheers,
Alexandre


On Jul 25, 2014, at 8:41 PM, Hernán Morales Durand <hernan.morales@gmail.com> wrote:

> Hello
>
> I am trying GET2 pieDiagram builder. You may want to add a random color in the #pieExample method so it looks nicer (see attachment):
>
> | diag |
> diag := GET2DiagramBuilder new.
> (diag pieDiagram)
>     models: #(30 10 20 40);
>     color: [ Color random ].
> ^ diag open.
>
> Now my question is simple, but I don't know how to start
>
> How would you add labels to each sector?
>
> Hernán
>
>
> <PieChart_1.png>_______________________________________________
> Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev

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




_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev