Chart Builder DSL /Too/ Good?

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

Chart Builder DSL /Too/ Good?

Sean P. DeNigris
Administrator
Roassal is sooo cool! Maybe /too/ cool?! ;-)

I'm having a hard time with RTCharterBuilder. My confusion comes from everything appearing on the same level, kind of like Amber's html canvas being magically changed when you enter a tag #with: block. Check out this snippet for example:

        b := RTCharterBuilder new.
        ...
        b interaction popupText: [ :point | point someMessage ].
        b points: aCollectionOfPointsOfTypeA.
        b connectDotColor: Color green.
        b y: [ :r | r newLikes ].
        b x: [ :d | d date julianDayNumber ].
       
        ...
        b interaction popupText: [ :point | point anotherMessage ].
        b points: aCollectionOfPointsOfTypeB.
        b connectDotColor: Color red.
        b y: [ :r | r second * 50 ].
        b x: [ :d | d first julianDayNumber ].

The fact that #x: and y: mean different things depending on the order of the rest of the script is a little "too helpful" to me. I'd much rather have things that are a property of a particular data set belong to a tangible object. Something like:

        dataSet := RTDataSet new
                points: anotherCollection;
                connectDotColor: Color red;
                y: [ :r | r second * 50 ];
                x: [ :d | d first julianDayNumber ].
        b addDataSet: dataSet.

The magic confuses other not-so-magical things. Like, afterwards, I tried to set #popupText: differently for each data set, but they all seemed to be applied to the both data sets, and were causing errors because the type of points were different, so I was getting DNUs. Now here was the real cost: I wasn't sure whether #popupText: was per-chart, or there was some special ordering necessary e.g. "#popupText: before #points:". This lead to flopping around followed by giving up. I eventually got frustrated enough that I hacked in an #isKindOf: in both #popupText: blocks since I couldn't delegate the #popupText: to the point objects because it was specific to this particular chart.
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Chart Builder DSL /Too/ Good?

abergel
Hi Sean,

Thank you very much about all your feedback. You have sent many emails about Roassal (which is good!). As you can imagine, we are all having a crazy time at ESUG. After ESUG I will take time to carefully reply to all your emails.
So, bare with us if we are slow at answering now :-)

Cheers,
Alexandre


On Aug 21, 2014, at 12:39 AM, Sean P. DeNigris <[hidden email]> wrote:

> Roassal is sooo cool! Maybe /too/ cool?! ;-)
>
> I'm having a hard time with RTCharterBuilder. My confusion comes from
> everything appearing on the same level, kind of like Amber's html canvas
> being magically changed when you enter a tag #with: block. Check out this
> snippet for example:
>
> b := RTCharterBuilder new.
> ...
> b interaction popupText: [ :point | point someMessage ].
> b points: aCollectionOfPointsOfTypeA.
> b connectDotColor: Color green.
> b y: [ :r | r newLikes ].
> b x: [ :d | d date julianDayNumber ].
>
> ...
> b interaction popupText: [ :point | point anotherMessage ].
> b points: aCollectionOfPointsOfTypeB.
> b connectDotColor: Color red.
> b y: [ :r | r second * 50 ].
> b x: [ :d | d first julianDayNumber ].
>
> The fact that #x: and y: mean different things depending on the order of the
> rest of the script is a little "too helpful" to me. I'd much rather have
> things that are a property of a particular data set belong to a tangible
> object. Something like:
>
> dataSet := RTDataSet new
> points: anotherCollection;
> connectDotColor: Color red;
> y: [ :r | r second * 50 ];
> x: [ :d | d first julianDayNumber ].
> b addDataSet: dataSet.
>
> The magic confuses other not-so-magical things. Like, afterwards, I tried to
> set #popupText: differently for each data set, but they all seemed to be
> applied to the both data sets, and were causing errors because the type of
> points were different, so I was getting DNUs. Now here was the real cost: I
> wasn't sure whether #popupText: was per-chart, or there was some special
> ordering necessary e.g. "#popupText: before #points:". This lead to flopping
> around followed by giving up. I eventually got frustrated enough that I
> hacked in an #isKindOf: in both #popupText: blocks since I couldn't delegate
> the #popupText: to the point objects because it was specific to this
> particular chart.
>
>
>
> -----
> Cheers,
> Sean
> --
> View this message in context: http://forum.world.st/Chart-Builder-DSL-Too-Good-tp4773990.html
> Sent from the Moose mailing list archive at Nabble.com.
> _______________________________________________
> 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: Chart Builder DSL /Too/ Good?

Sean P. DeNigris
Administrator
On Aug 21, 2014, at 7:24 AM, abergel [via Smalltalk] <[hidden email]> wrote:
> Thank you very much about all your feedback. You have sent many emails about Roassal (which is good!). As you can imagine, we are all having a crazy time at ESUG. After ESUG I will take time to carefully reply to all your emails.
> So, bare with us if we are slow at answering now :-)
Totally understood. I wished they would’ve dripped out more uniformly, but figured it was better to record my raw impressions. Take your time...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Chart Builder DSL /Too/ Good?

abergel
In reply to this post by Sean P. DeNigris
Hi Sean,

Again, sorry for the long delay to answer.

Defining a nice and intuitive DSL for charting is quite difficult. The class RTCharterBuilder will surely evolve in the future (which also imply what part of the chapter will be rewritten). 

Consider the following script:
-=-=-=-=-=-=-=-=-=
b := RTCharterBuilder new.
b extent: 300 @ 200.

b interaction popup.
b shape circle color: (Color blue alpha: 0.3).
b points: RTShape withAllSubclasses.
b x: #numberOfMethods.
b y: #numberOfLinesOfCode.

b axisX; axisY.
b build
-=-=-=-=-=-=-=-=-=
You obtain the following:

If you want to add another chart on it, then you can do:

-=-=-=-=-=-=-=-=-=
b := RTCharterBuilder new.
b extent: 300 @ 200.

b interaction popup.
b shape circle color: (Color blue alpha: 0.3).
b points: RTShape withAllSubclasses.
b x: #numberOfMethods.
b y: #numberOfLinesOfCode.

b shape circle color: (Color red alpha: 0.3).
b points: TRShape withAllSubclasses.
b x: #numberOfMethods.
b y: #numberOfLinesOfCode.

b axisX; axisY.
b build
-=-=-=-=-=-=-=-=-=

You obtain the following:

The two scatterplots are superposed. Something is still wrong however, the axis ranges are wrong since the two charts use different scales. 

To use the same scale, for now, we need to use the same metrics, as in the following example:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
b := RTCharterBuilder new.
b extent: 300 @ 200.

b interaction popup.
b shape circle color: (Color blue alpha: 0.3).
b points: RTShape withAllSubclasses.

b shape circle color: (Color red alpha: 0.3).
b points: TRShape withAllSubclasses.
b allX: #numberOfMethods.
b allY: #numberOfLinesOfCode.

b axisX; axisY.
b build
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=



If you want to have two different popup, you can do:
-=-=-=-=-=-=-=-=-=-=
b := RTCharterBuilder new.
b extent: 300 @ 200.

b interaction popupText: [ :c | 'Roassal class: ', c name ].
b shape circle color: (Color blue alpha: 0.3).
b points: RTShape withAllSubclasses.

b resetInteraction.
b interaction popupText: [ :c | 'Trachel class: ', c name ].
b shape circle color: (Color red alpha: 0.3).
b points: TRShape withAllSubclasses.

b allX: #numberOfMethods.
b allY: #numberOfLinesOfCode.

b axisX; axisY.
b build
-=-=-=-=-=-=-=-=-=-=

Does this help ?
I see you are trying to use two different sets of X/Y metrics. Can you say a bit more about that?

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



On Aug 20, 2014, at 7:39 PM, Sean P. DeNigris <[hidden email]> wrote:

Roassal is sooo cool! Maybe /too/ cool?! ;-)

I'm having a hard time with RTCharterBuilder. My confusion comes from
everything appearing on the same level, kind of like Amber's html canvas
being magically changed when you enter a tag #with: block. Check out this
snippet for example:

b := RTCharterBuilder new.
...
b interaction popupText: [ :point | point someMessage ].
b points: aCollectionOfPointsOfTypeA.
b connectDotColor: Color green.
b y: [ :r | r newLikes ].
b x: [ :d | d date julianDayNumber ].

...
b interaction popupText: [ :point | point anotherMessage ].
b points: aCollectionOfPointsOfTypeB.
b connectDotColor: Color red.
b y: [ :r | r second * 50 ].
b x: [ :d | d first julianDayNumber ].

The fact that #x: and y: mean different things depending on the order of the
rest of the script is a little "too helpful" to me. I'd much rather have
things that are a property of a particular data set belong to a tangible
object. Something like:

dataSet := RTDataSet new
points: anotherCollection;
connectDotColor: Color red;
y: [ :r | r second * 50 ];
x: [ :d | d first julianDayNumber ].
b addDataSet: dataSet.

The magic confuses other not-so-magical things. Like, afterwards, I tried to
set #popupText: differently for each data set, but they all seemed to be
applied to the both data sets, and were causing errors because the type of
points were different, so I was getting DNUs. Now here was the real cost: I
wasn't sure whether #popupText: was per-chart, or there was some special
ordering necessary e.g. "#popupText: before #points:". This lead to flopping
around followed by giving up. I eventually got frustrated enough that I
hacked in an #isKindOf: in both #popupText: blocks since I couldn't delegate
the #popupText: to the point objects because it was specific to this
particular chart.



-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Chart-Builder-DSL-Too-Good-tp4773990.html
Sent from the Moose mailing list archive at Nabble.com.
_______________________________________________
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