Date on the X-axis with Charter

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

Date on the X-axis with Charter

abergel
Hi!

Here is a post that describe how to have dates on the X-axis. 
This has been a recurrent problem, which is why I would like to share it with you. 

Dates are particular values that requires an adequate control over what is being displayed on X-axis. The julianDayNumber converts a date into a number.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
methods := RTObject withAllSubclasses flatCollect: #methods.
methods := methods reject: [ :m | m numberOfLinesOfCode > 150 ].
oldestMethod := methods minFor: #date.

b := RTCharterBuilder new.
b extent: 800 @ 200.
b shape circle size: 5; color: (Color blue alpha: 0.1).
b interaction popup.
b points: methods.
b allY: #numberOfLinesOfCode.
b allX: [ :m | m date julianDayNumber - oldestMethod date julianDayNumber ].

b axisConfiguration 
noDecimals;
title: 'LOC'.
b axisY.
b axisConfiguration 
title: '';
labelRotation: -30;
numberOfTicks: 10;
numberOfLabels: 10;
labelConvertion: [ :v | (Date julianDayNumber: v + oldestMethod date julianDayNumber) ].
b axisX.

b build
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
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: Date on the X-axis with Charter

Offray
Hi Alexandre,

This seems related with other question I have made on the Pharo list
about visualizing the history of a SmalltalkHub repository, so I gave it
a shot, but when I paste the code "minFor:" and "labelRotaion:" are in
red. Need I to update something? (system update keep them red).

Cheers,

Offray

On 09/22/2014 03:31 PM, Alexandre Bergel wrote:

> Hi!
>
> Here is a post that describe how to have dates on the X-axis.
> This has been a recurrent problem, which is why I would like to share it with you.
>
> Dates are particular values that requires an adequate control over what is being
> displayed on X-axis. The julianDayNumber converts a date into a number.
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> methods := RTObject withAllSubclasses flatCollect: #methods.
> methods := methods reject: [ :m | m numberOfLinesOfCode > 150 ].
> oldestMethod := methods minFor: #date.
>
> b := RTCharterBuilder new.
> b extent: 800 @ 200.
> b shape circle size: 5; color: (Color blue alpha: 0.1).
> b interaction popup.
> b points: methods.
> b allY: #numberOfLinesOfCode.
> b allX: [ :m | m date julianDayNumber - oldestMethod date julianDayNumber ].
>
> b axisConfiguration
> noDecimals;
> title: 'LOC'.
> b axisY.
> b axisConfiguration
> title: '';
> labelRotation: -30;
> numberOfTicks: 10;
> numberOfLabels: 10;
> labelConvertion: [ :v | (Date julianDayNumber: v + oldestMethod date
> julianDayNumber) ].
> b axisX.
>
> b build
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Cheers,
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

SergeStinckwich
In reply to this post by abergel
Thank you Alex.

I was able to plot some nice Ebola cases very easily now:

================================================================
tab := RTTabTable new input: (ZnEasy
contents usingDelimiter: $,.
tab removeFirstRow.
tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
tab convertColumnsAsInteger: (2 to: 12) asArray.
tab convertColumnAsDateAndTime: 1.
tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
data := tab values reversed.

minEntry := data minF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aJwJwwJ1kQCDlCwTAcMh6KhDQnVSwYTkJ1un1gc5wtdxsh5iqaLbVKyTEWigq4ugZglRXpRX5J5DJYAFIAaVVlfhNrURqFVQ9DYhqCgzkzCGdnVQBwGRU0LQiXCRUAORQJCwAcOTChoYplBXIKLq6vUXRCCQ22olUEcroJB66KD8FNCjUrlxWpTUEAIfkEBTAAOQAsAAAAABAAEAAABobAnDAnWRAIOULBMBwyHoqENCdVLBhOQnW6fWBznC13G8nZchXNllql5Bg2xA1cZQOwShwCMdDkLgk5GVgAUgAie3syVDkTbFIaiIkIJ0NiGnp7HiNonRVVAHEuFjlQFVQVAI0JCzYjrKCPZQWnf1unYkMVWrFbBLVoUIaPD8C6CwCnAMhNQQA7">

b := RTCharterBuilder new.
b extent: 400@200.
b shape ellipse size:0.
b points: data.
b connectDotColor: Color blue.
b allY: [ :v | v at: 3 ].
b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].

b axisConfiguration 
labelRotation: -30;
labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first julianDayNumber) ].
b axisX.

b resetAxisConfiguration.
b axisY.
b build.

lb := RTLegend2Builder new.
lb view: b view.
lb addText: 'Ebola cases'.
lb addColor: Color blue text: 'Guinea cases'.
lb build
================================================================


Inline image 2



On Mon, Sep 22, 2014 at 10:31 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

Here is a post that describe how to have dates on the X-axis. 
This has been a recurrent problem, which is why I would like to share it with you. 

Dates are particular values that requires an adequate control over what is being displayed on X-axis. The julianDayNumber converts a date into a number.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
methods := RTObject withAllSubclasses flatCollect: #methods.
methods := methods reject: [ :m | m numberOfLinesOfCode > 150 ].
oldestMethod := methods minFor: #date.

b := RTCharterBuilder new.
b extent: 800 @ 200.
b shape circle size: 5; color: (Color blue alpha: 0.1).
b interaction popup.
b points: methods.
b allY: #numberOfLinesOfCode.
b allX: [ :m | m date julianDayNumber - oldestMethod date julianDayNumber ].

b axisConfiguration 
noDecimals;
title: 'LOC'.
b axisY.
b axisConfiguration 
title: '';
labelRotation: -30;
numberOfTicks: 10;
numberOfLabels: 10;
labelConvertion: [ :v | (Date julianDayNumber: v + oldestMethod date julianDayNumber) ].
b axisX.

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




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

abergel
Impressive graph!

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



On Sep 23, 2014, at 6:13 AM, Serge Stinckwich <[hidden email]> wrote:

Thank you Alex.

I was able to plot some nice Ebola cases very easily now:

================================================================
tab := RTTabTable new input: (ZnEasy
contents usingDelimiter: $,.
tab removeFirstRow.
tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
tab convertColumnsAsInteger: (2 to: 12) asArray.
tab convertColumnAsDateAndTime: 1.
tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
data := tab values reversed.

minEntry := data minFor: #first.<img width="16" height="16" src="data:image/gif;base64,R0lGODlhEAAQAOUdAOvr69HR0cHBwby8vOzs7PHx8ff397W1tbOzs+Xl5ebm5vDw8PPz88PDw7e3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hqCgzkzCGdnVQBwGRU0LQiXCRUAORQJCwAcOTChoYplBXIKLq6vUXRCCQ22olUEcroJB66KD8FNCjUrlxWpTUEAIfkEBTAAOQAsAAAAABAAEAAABobAnDAnWRAIOULBMBwyHoqENCdVLBhOQnW6fWBznC13G8nZchXNllql5Bg2xA1cZQOwShwCMdDkLgk5GVgAUgAie3syVDkTbFIaiIkIJ0NiGnp7HiNonRVVAHEuFjlQFVQVAI0JCzYjrKCPZQWnf1unYkMVWrFbBLVoUIaPD8C6CwCnAMhNQQA7">

b := RTCharterBuilder new.
b extent: 400@200.
b shape ellipse size:0.
b points: data.
b connectDotColor: Color blue.
b allY: [ :v | v at: 3 ].
b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].

b axisConfiguration 
labelRotation: -30;
labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first julianDayNumber) ].
b axisX.

b resetAxisConfiguration.
b axisY.
b build.

lb := RTLegend2Builder new.
lb view: b view.
lb addText: 'Ebola cases'.
lb addColor: Color blue text: 'Guinea cases'.
lb build
================================================================


<Screen Shot 2014-09-23 at 11.03.04.png>



On Mon, Sep 22, 2014 at 10:31 PM, Alexandre Bergel <[hidden email]> wrote:
Hi!

Here is a post that describe how to have dates on the X-axis. 
This has been a recurrent problem, which is why I would like to share it with you. 

Dates are particular values that requires an adequate control over what is being displayed on X-axis. The julianDayNumber converts a date into a number.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
methods := RTObject withAllSubclasses flatCollect: #methods.
methods := methods reject: [ :m | m numberOfLinesOfCode > 150 ].
oldestMethod := methods minFor: #date.

b := RTCharterBuilder new.
b extent: 800 @ 200.
b shape circle size: 5; color: (Color blue alpha: 0.1).
b interaction popup.
b points: methods.
b allY: #numberOfLinesOfCode.
b allX: [ :m | m date julianDayNumber - oldestMethod date julianDayNumber ].

b axisConfiguration 
noDecimals;
title: 'LOC'.
b axisY.
b axisConfiguration 
title: '';
labelRotation: -30;
numberOfTicks: 10;
numberOfLabels: 10;
labelConvertion: [ :v | (Date julianDayNumber: v + oldestMethod date julianDayNumber) ].
b axisX.

b build
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
<Screen Shot 2014-09-22 at 5.23.22 PM.png>
Cheers,
Alexandre
-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev




--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

abergel
In reply to this post by Offray
Yes, you need to update Roassal2. You can use the Monticello browser for this, or simply download a new image (Moose 5.0 beta image)
#minFor: is defined on the class Collection 

What do you mean by “system update” ?

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



On Sep 22, 2014, at 9:38 PM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote:

Hi Alexandre,

This seems related with other question I have made on the Pharo list about visualizing the history of a SmalltalkHub repository, so I gave it a shot, but when I paste the code "minFor:" and "labelRotaion:" are in red. Need I to update something? (system update keep them red).

Cheers,

Offray

On 09/22/2014 03:31 PM, Alexandre Bergel wrote:
Hi!

Here is a post that describe how to have dates on the X-axis.
This has been a recurrent problem, which is why I would like to share it with you.

Dates are particular values that requires an adequate control over what is being
displayed on X-axis. The julianDayNumber converts a date into a number.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
methods := RTObject withAllSubclasses flatCollect: #methods.
methods := methods reject: [ :m | m numberOfLinesOfCode > 150 ].
oldestMethod := methods minFor: #date.

b := RTCharterBuilder new.
b extent: 800 @ 200.
b shape circle size: 5; color: (Color blue alpha: 0.1).
b interaction popup.
b points: methods.
b allY: #numberOfLinesOfCode.
b allX: [ :m | m date julianDayNumber - oldestMethod date julianDayNumber ].

b axisConfiguration
noDecimals;
title: 'LOC'.
b axisY.
b axisConfiguration
title: '';
labelRotation: -30;
numberOfTicks: 10;
numberOfLabels: 10;
labelConvertion: [ :v | (Date julianDayNumber: v + oldestMethod date
julianDayNumber) ].
b axisX.

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





_______________________________________________
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


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

Offray
Alexandre,

On 09/23/2014 03:50 PM, Alexandre Bergel wrote:
> Yes, you need to update Roassal2. You can use the Monticello browser for this,
> or simply download a new image (Moose 5.0 beta image
> <https://ci.inria.fr/moose/job/moose-5.0/lastSuccessfulBuild/artifact/moose-5.0.zip>)
> #minFor: is defined on the class Collection

Thanks it worked like a charm! Here is the screenshot:

[1]
http://mutabit.com/deltas/repos.fossil/grafoscopio-escritos/doc/tip/Figuras/autorretrato-metodos-con-fecha.png

It's also nice to notice that now I'm able to save this code inside a
"notebook" created/stored inside Pharo itself:

[2] http://www.enlightenment.org/ss/e-5423297ee88c18.64873528.jpg

This notebook can be exported in STON, Markdown directly and pdf via
pandoc, as you can see here:

[3] http://www.enlightenment.org/ss/e-54203e5c1de6e7.91406521.jpg
[4] http://www.enlightenment.org/ss/e-54232be72039d8.73743775.jpg

So, is a really nice to be able to use Pharo itself to document the
learning on this community and get so much help from all of you. Thanks
again.

> What do you mean by “system update” ?

The option you get from World Menu > System > Software Update.

> Cheers,
> Alexandre

Cheers,

Offray

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

abergel
So, is a really nice to be able to use Pharo itself to document the learning on this community and get so much help from all of you. Thanks again.

You’re very welcome! Your experience is really important for the community.

What do you mean by “system update” ?

The option you get from World Menu > System > Software Update.

I have never used this. This is not the way to update Roassal :-)

Alexandre

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

Offray
In reply to this post by SergeStinckwich
Hi Serge,

I see that your graph has two texts, 'Ebola cases' and 'Guinea cases',
but I get only one blue line colored plot. Is that the intended, and
what these two labels means? (particularly Guinea cases).

Cheers,

Offray

On 09/23/2014 04:13 AM, Serge Stinckwich wrote:

> Thank you Alex.
>
> I was able to plot some nice Ebola cases very easily now:
>
> ================================================================
> tab := RTTabTable new input: (ZnEasy
> get:
> 'https://raw.githubusercontent.com/cmrivers/ebola/master/country_timeseries.csv')
> contents usingDelimiter: $,.
> tab removeFirstRow.
> tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
> tab convertColumnsAsInteger: (2 to: 12) asArray.
> tab convertColumnAsDateAndTime: 1.
> tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
> data := tab values reversed.
>
> minEntry := data minFor: #first.
>
> b := RTCharterBuilder new.
> b extent: 400@200.
> b shape ellipse size:0.
> b points: data.
> b connectDotColor: Color blue.
> b allY: [ :v | v at: 3 ].
> b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].
>
> b axisConfiguration
> labelRotation: -30;
> labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first
> julianDayNumber) ].
> b axisX.
>
> b resetAxisConfiguration.
> b axisY.
> b build.
>
> lb := RTLegend2Builder new.
> lb view: b view.
> lb addText: 'Ebola cases'.
> lb addColor: Color blue text: 'Guinea cases'.
> lb build
> ================================================================
>
>
> Inline image 2
>
>
>
> On Mon, Sep 22, 2014 at 10:31 PM, Alexandre Bergel <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>      Hi!
>
>      Here is a post that describe how to have dates on the X-axis.
>      This has been a recurrent problem, which is why I would like to share it
>      with you.
>
>      Dates are particular values that requires an adequate control over what is
>      being displayed on X-axis. The julianDayNumber converts a date into a number.
>
>      -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>      methods := RTObject withAllSubclasses flatCollect: #methods.
>      methods := methods reject: [ :m | m numberOfLinesOfCode > 150 ].
>      oldestMethod := methods minFor: #date.
>
>      b := RTCharterBuilder new.
>      b extent: 800 @ 200.
>      b shape circle size: 5; color: (Color blue alpha: 0.1).
>      b interaction popup.
>      b points: methods.
>      b allY: #numberOfLinesOfCode.
>      b allX: [ :m | m date julianDayNumber - oldestMethod date julianDayNumber ].
>
>      b axisConfiguration
>      noDecimals;
>      title: 'LOC'.
>      b axisY.
>      b axisConfiguration
>      title: '';
>      labelRotation: -30;
>      numberOfTicks: 10;
>      numberOfLabels: 10;
>      labelConvertion: [ :v | (Date julianDayNumber: v + oldestMethod date
>      julianDayNumber) ].
>      b axisX.
>
>      b build
>      -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>      Cheers,
>      Alexandre
>      --
>      _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>      Alexandre Bergel http://www.bergel.eu
>      ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
>      _______________________________________________
>      Moose-dev mailing list
>      [hidden email] <mailto:[hidden email]>
>      https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
>
>
>
> --
> Serge Stinckwich
> UCBN & UMI UMMISCO 209 (IRD/UPMC)
> Every DSL ends up being Smalltalk
> http://www.doesnotunderstand.org/
>
>
>
> _______________________________________________
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

SergeStinckwich
On Thu, Sep 25, 2014 at 6:41 PM, Offray Vladimir Luna Cárdenas
<[hidden email]> wrote:
> Hi Serge,
>
> I see that your graph has two texts, 'Ebola cases' and 'Guinea cases', but I
> get only one blue line colored plot. Is that the intended, and what these
> two labels means? (particularly Guinea cases).

My idea was to plot many curve for each country (not done in this script).
The first label is the text of the legend, the second one, the name of
the blue curve.


This is an example with two countries:
===================================================

tab := RTTabTable new input: (ZnEasy
get: 'https://raw.githubusercontent.com/cmrivers/ebola/master/country_timeseries.csv')
contents usingDelimiter: $,.
tab removeFirstRow.
tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
tab convertColumnsAsInteger: (2 to: 12) asArray.
tab convertColumnAsDateAndTime: 1.
tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
data := tab values reversed.

minEntry := data minFor: #first.

b := RTCharterBuilder new.
b extent: 400@200.
b shape ellipse size:0.
b points: data.
b connectDotColor: Color blue.
b allY: [ :v | v at: 3 ].
b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].

b points: data.
b connectDotColor: Color green.
b allY: [ :v | v at: 4 ].
b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].

b axisConfiguration
labelRotation: -30;
labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first
julianDayNumber) ].
b axisX.

b resetAxisConfiguration.
b axisY.
b build.

lb := RTLegend2Builder new.
lb view: b view.
lb addText: 'Ebola cases'.
lb addColor: Color blue text: 'Guinea'.
lb addColor: Color green text: 'Liberia'.
lb build.
b open.
===================================================


Regards,
--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

abergel
In reply to this post by abergel
Just for the record, RTLegend2Builder has been renamed into RTLegendBuilder

Alexandre


On Sep 23, 2014, at 5:48 PM, Alexandre Bergel <[hidden email]> wrote:

> Impressive graph!
>
> Alexandre
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
> On Sep 23, 2014, at 6:13 AM, Serge Stinckwich <[hidden email]> wrote:
>
>> Thank you Alex.
>>
>> I was able to plot some nice Ebola cases very easily now:
>>
>> ================================================================
>> tab := RTTabTable new input: (ZnEasy
>> get: 'https://raw.githubusercontent.com/cmrivers/ebola/master/country_timeseries.csv')
>> contents usingDelimiter: $,.
>> tab removeFirstRow.
>> tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
>> tab convertColumnsAsInteger: (2 to: 12) asArray.
>> tab convertColumnAsDateAndTime: 1.
>> tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
>> data := tab values reversed.
>>
>> minEntry := data minFor: #first.
>>
>> b := RTCharterBuilder new.
>> b extent: 400@200.
>> b shape ellipse size:0.
>> b points: data.
>> b connectDotColor: Color blue.
>> b allY: [ :v | v at: 3 ].
>> b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].
>>
>> b axisConfiguration
>> labelRotation: -30;
>> labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first julianDayNumber) ].
>> b axisX.
>>
>> b resetAxisConfiguration.
>> b axisY.
>> b build.
>>
>> lb := RTLegend2Builder new.
>> lb view: b view.
>> lb addText: 'Ebola cases'.
>> lb addColor: Color blue text: 'Guinea cases'.
>> lb build
>> ================================================================
>>
>>
>> <Screen Shot 2014-09-23 at 11.03.04.png>
>>
>>
>>
>> On Mon, Sep 22, 2014 at 10:31 PM, Alexandre Bergel <[hidden email]> wrote:
>> Hi!
>>
>> Here is a post that describe how to have dates on the X-axis.
>> This has been a recurrent problem, which is why I would like to share it with you.
>>
>> Dates are particular values that requires an adequate control over what is being displayed on X-axis. The julianDayNumber converts a date into a number.
>>
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> methods := RTObject withAllSubclasses flatCollect: #methods.
>> methods := methods reject: [ :m | m numberOfLinesOfCode > 150 ].
>> oldestMethod := methods minFor: #date.
>>
>> b := RTCharterBuilder new.
>> b extent: 800 @ 200.
>> b shape circle size: 5; color: (Color blue alpha: 0.1).
>> b interaction popup.
>> b points: methods.
>> b allY: #numberOfLinesOfCode.
>> b allX: [ :m | m date julianDayNumber - oldestMethod date julianDayNumber ].
>>
>> b axisConfiguration
>> noDecimals;
>> title: 'LOC'.
>> b axisY.
>> b axisConfiguration
>> title: '';
>> labelRotation: -30;
>> numberOfTicks: 10;
>> numberOfLabels: 10;
>> labelConvertion: [ :v | (Date julianDayNumber: v + oldestMethod date julianDayNumber) ].
>> b axisX.
>>
>> b build
>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>> <Screen Shot 2014-09-22 at 5.23.22 PM.png>
>> Cheers,
>> Alexandre
>> --
>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>> Alexandre Bergel  http://www.bergel.eu
>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>>
>>
>>
>> --
>> Serge Stinckwich
>> UCBN & UMI UMMISCO 209 (IRD/UPMC)
>> Every DSL ends up being Smalltalk
>> http://www.doesnotunderstand.org/
>> _______________________________________________
>> 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

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
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: Date on the X-axis with Charter

abergel
In reply to this post by SergeStinckwich
Hi Serge,

The script you have sent does not work well. Curves are not in the graphs :-(
I think Bui has produce graphs that correctly use Charter

Do you have the version Bui produced?

Cheers,
Alexandre


On Sep 29, 2014, at 7:31 AM, Serge Stinckwich <[hidden email]> wrote:

> On Thu, Sep 25, 2014 at 6:41 PM, Offray Vladimir Luna Cárdenas
> <[hidden email]> wrote:
>> Hi Serge,
>>
>> I see that your graph has two texts, 'Ebola cases' and 'Guinea cases', but I
>> get only one blue line colored plot. Is that the intended, and what these
>> two labels means? (particularly Guinea cases).
>
> My idea was to plot many curve for each country (not done in this script).
> The first label is the text of the legend, the second one, the name of
> the blue curve.
>
>
> This is an example with two countries:
> ===================================================
>
> tab := RTTabTable new input: (ZnEasy
> get: 'https://raw.githubusercontent.com/cmrivers/ebola/master/country_timeseries.csv')
> contents usingDelimiter: $,.
> tab removeFirstRow.
> tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
> tab convertColumnsAsInteger: (2 to: 12) asArray.
> tab convertColumnAsDateAndTime: 1.
> tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
> data := tab values reversed.
>
> minEntry := data minFor: #first.
>
> b := RTCharterBuilder new.
> b extent: 400@200.
> b shape ellipse size:0.
> b points: data.
> b connectDotColor: Color blue.
> b allY: [ :v | v at: 3 ].
> b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].
>
> b points: data.
> b connectDotColor: Color green.
> b allY: [ :v | v at: 4 ].
> b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].
>
> b axisConfiguration
> labelRotation: -30;
> labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first
> julianDayNumber) ].
> b axisX.
>
> b resetAxisConfiguration.
> b axisY.
> b build.
>
> lb := RTLegend2Builder new.
> lb view: b view.
> lb addText: 'Ebola cases'.
> lb addColor: Color blue text: 'Guinea'.
> lb addColor: Color green text: 'Liberia'.
> lb build.
> b open.
> ===================================================
>
>
> Regards,
> --
> Serge Stinckwich
> UCBN & UMI UMMISCO 209 (IRD/UPMC)
> Every DSL ends up being Smalltalk
> http://www.doesnotunderstand.org/
>
> _______________________________________________
> 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: Date on the X-axis with Charter

SergeStinckwich
Hi Alex,

We will start to work on the challenge this morning with Mai Anh.
I already made a list of issues regarding enhancements can could
implemented for Kendrick (including visualisations):
https://github.com/UMMISCO/Kendrick/issues

We will made some report from time to time.

Thank you for your help.
Regards,

On Mon, Oct 6, 2014 at 3:36 AM, Alexandre Bergel
<[hidden email]> wrote:

> Hi Serge,
>
> The script you have sent does not work well. Curves are not in the graphs :-(
> I think Bui has produce graphs that correctly use Charter
>
> Do you have the version Bui produced?
>
> Cheers,
> Alexandre
>
>
> On Sep 29, 2014, at 7:31 AM, Serge Stinckwich <[hidden email]> wrote:
>
>> On Thu, Sep 25, 2014 at 6:41 PM, Offray Vladimir Luna Cárdenas
>> <[hidden email]> wrote:
>>> Hi Serge,
>>>
>>> I see that your graph has two texts, 'Ebola cases' and 'Guinea cases', but I
>>> get only one blue line colored plot. Is that the intended, and what these
>>> two labels means? (particularly Guinea cases).
>>
>> My idea was to plot many curve for each country (not done in this script).
>> The first label is the text of the legend, the second one, the name of
>> the blue curve.
>>
>>
>> This is an example with two countries:
>> ===================================================
>>
>> tab := RTTabTable new input: (ZnEasy
>> get: 'https://raw.githubusercontent.com/cmrivers/ebola/master/country_timeseries.csv')
>> contents usingDelimiter: $,.
>> tab removeFirstRow.
>> tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
>> tab convertColumnsAsInteger: (2 to: 12) asArray.
>> tab convertColumnAsDateAndTime: 1.
>> tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
>> data := tab values reversed.
>>
>> minEntry := data minFor: #first.
>>
>> b := RTCharterBuilder new.
>> b extent: 400@200.
>> b shape ellipse size:0.
>> b points: data.
>> b connectDotColor: Color blue.
>> b allY: [ :v | v at: 3 ].
>> b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].
>>
>> b points: data.
>> b connectDotColor: Color green.
>> b allY: [ :v | v at: 4 ].
>> b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].
>>
>> b axisConfiguration
>> labelRotation: -30;
>> labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first
>> julianDayNumber) ].
>> b axisX.
>>
>> b resetAxisConfiguration.
>> b axisY.
>> b build.
>>
>> lb := RTLegend2Builder new.
>> lb view: b view.
>> lb addText: 'Ebola cases'.
>> lb addColor: Color blue text: 'Guinea'.
>> lb addColor: Color green text: 'Liberia'.
>> lb build.
>> b open.
>> ===================================================
>>
>>
>> Regards,
>> --
>> Serge Stinckwich
>> UCBN & UMI UMMISCO 209 (IRD/UPMC)
>> Every DSL ends up being Smalltalk
>> http://www.doesnotunderstand.org/
>>
>> _______________________________________________
>> 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



--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Help fight Ebola by joining the Computing for Ebola Challenge
http://bit.ly/1oEdBag

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

abergel
That is a lot :-)

Bui told me it would be useful to have expansion of Graph nodes. 
This is something we can easily do. We are working on this now..

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



On Oct 6, 2014, at 4:30 AM, Serge Stinckwich <[hidden email]> wrote:

Hi Alex,

We will start to work on the challenge this morning with Mai Anh.
I already made a list of issues regarding enhancements can could
implemented for Kendrick (including visualisations):
https://github.com/UMMISCO/Kendrick/issues

We will made some report from time to time.

Thank you for your help.
Regards,

On Mon, Oct 6, 2014 at 3:36 AM, Alexandre Bergel
<[hidden email]> wrote:
Hi Serge,

The script you have sent does not work well. Curves are not in the graphs :-(
I think Bui has produce graphs that correctly use Charter

Do you have the version Bui produced?

Cheers,
Alexandre


On Sep 29, 2014, at 7:31 AM, Serge Stinckwich <[hidden email]> wrote:

On Thu, Sep 25, 2014 at 6:41 PM, Offray Vladimir Luna Cárdenas
<[hidden email]> wrote:
Hi Serge,

I see that your graph has two texts, 'Ebola cases' and 'Guinea cases', but I
get only one blue line colored plot. Is that the intended, and what these
two labels means? (particularly Guinea cases).

My idea was to plot many curve for each country (not done in this script).
The first label is the text of the legend, the second one, the name of
the blue curve.


This is an example with two countries:
===================================================

tab := RTTabTable new input: (ZnEasy
get: 'https://raw.githubusercontent.com/cmrivers/ebola/master/country_timeseries.csv')
contents usingDelimiter: $,.
tab removeFirstRow.
tab replaceEmptyValuesWith: '0' inColumns: (2 to: 12) asArray.
tab convertColumnsAsInteger: (2 to: 12) asArray.
tab convertColumnAsDateAndTime: 1.
tab replaceZeroWithCumulativeValuesInColumns: (2 to:12) asArray.
data := tab values reversed.

minEntry := data minFor: #first.

b := RTCharterBuilder new.
b extent: 400@200.
b shape ellipse size:0.
b points: data.
b connectDotColor: Color blue.
b allY: [ :v | v at: 3 ].
b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].

b points: data.
b connectDotColor: Color green.
b allY: [ :v | v at: 4 ].
b allX: [ :v | v first julianDayNumber - minEntry first julianDayNumber ].

b axisConfiguration
labelRotation: -30;
labelConvertion: [ :v | (Date julianDayNumber: v + minEntry first
julianDayNumber) ].
b axisX.

b resetAxisConfiguration.
b axisY.
b build.

lb := RTLegend2Builder new.
lb view: b view.
lb addText: 'Ebola cases'.
lb addColor: Color blue text: 'Guinea'.
lb addColor: Color green text: 'Liberia'.
lb build.
b open.
===================================================


Regards,
--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/

_______________________________________________
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



--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Help fight Ebola by joining the Computing for Ebola Challenge
http://bit.ly/1oEdBag

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Date on the X-axis with Charter

SergeStinckwich
On Tue, Oct 7, 2014 at 4:43 PM, Alexandre Bergel
<[hidden email]> wrote:
> That is a lot :-)

Yes ;-)

> Bui told me it would be useful to have expansion of Graph nodes.
> This is something we can easily do. We are working on this now..

Ok great ! We can wait on this one, not really urgent.
Thank you.

--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Help fight Ebola by joining the Computing for Ebola Challenge
http://bit.ly/1oEdBag
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev