Skip to content

Instantly share code, notes, and snippets.

@seandenigris
Created March 31, 2020 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seandenigris/d7b25f34613a50210d52f595371db4d0 to your computer and use it in GitHub Desktop.
Save seandenigris/d7b25f34613a50210d52f595371db4d0 to your computer and use it in GitHub Desktop.
onsets := {
'14 March 2020'.
'17 March 2020'.
'18 March 2020'.
'19 March 2020'.
'16 March 2020'.
'20 March 2020'.
'21 March 2020'.
'18 March 2020'.
'21 March 2020'.
'24 March 2020'.
'21 March 2020'.
'24 March 2020'.
'24 March 2020'.
'24 March 2020' } collect: #asDate.
dso := DataSeries withValues: onsets.
perDate := dso valueCounts sortAssociations: [ :a :b | a key < b key ].
sum := 0.
forFrame := perDate collect: [ :e | sum := sum + e ].
f := DataFrame withColumns: { forFrame values } columnNames: { 'newCases' }.
f rowNames: forFrame keys.
chart := RSChart new.
chart extent: 400@250.
chart addPlot:(RSLinePlot new x: (1 to: f size) y: (f column: #newCases) values).
chart addDecoration: (RSHorizontalTick new fromNames: ((f column: #newCases) keys collect: #asString)).
chart show.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment