Created
October 27, 2014 23:53
-
-
Save macta/dde89ab15ee4842a9852 to your computer and use it in GitHub Desktop.
Example Roassal Moose script for graphing Ebola data in the playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 := RTLegendBuilder new. | |
lb view: b view. | |
lb addText: 'Ebola cases'. | |
lb addColor: Color blue text: 'Guinea'. | |
lb addColor: Color green text: 'Liberia'. | |
lb build. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment