44 lines
1.4 KiB
Smalltalk
44 lines
1.4 KiB
Smalltalk
accessing
|
|
exportRepliesHistogramWithBars: aNumberOfBars
|
|
|
|
| tweetsByTimeSpan subtotals tweetsHistogram diagram |
|
|
|
|
self replies ifEmpty: [
|
|
tweetsHistogram := RSChart new.
|
|
tweetsHistogram extent: 800@200.
|
|
tweetsHistogram build.
|
|
tweetsHistogram canvas pdfExporter
|
|
zoomToShapes;
|
|
noFixedShapes;
|
|
fileName: (self folder / 'replies-histogram.pdf')fullName;
|
|
export.
|
|
^ self
|
|
].
|
|
tweetsByTimeSpan := self collectMessages: [ self replies ] byTimeSpanSplits: aNumberOfBars.
|
|
subtotals := tweetsByTimeSpan values collect: [ :collection | collection size ].
|
|
tweetsHistogram := RSChart new.
|
|
tweetsHistogram extent: 800@200.
|
|
diagram := RSBarPlot new
|
|
y:subtotals.
|
|
diagram color: (Color r:(246/255) g:(185/255) b:(46/255)).
|
|
tweetsHistogram addPlot: diagram.
|
|
tweetsHistogram addDecoration: (RSHorizontalTick new
|
|
fromNames: tweetsByTimeSpan keys;
|
|
labelRotation: 0;
|
|
fontSize: 72 /aNumberOfBars;
|
|
yourself).
|
|
tweetsHistogram addDecoration: (RSVerticalTick new
|
|
asFloat: 2;
|
|
fontSize: 72 /aNumberOfBars).
|
|
tweetsHistogram build.
|
|
tweetsHistogram canvas pngExporter
|
|
zoomToShapes;
|
|
noFixedShapes;
|
|
fileName: (self folder / 'replies-histogram.png')fullName;
|
|
export.
|
|
tweetsHistogram canvas pdfExporter
|
|
zoomToShapes;
|
|
noFixedShapes;
|
|
fileName: (self folder / 'replies-histogram.pdf')fullName;
|
|
export.
|
|
^ self folder / 'replies-histogram.png' |