Socialmetrica/Socialmetrica.package/NitterUser.class/instance/exportTweetsHistogramWithBars..st

29 lines
1010 B
Smalltalk

accessing
exportTweetsHistogramWithBars: aNumberOfBars
| tweetsByTimeSpan subtotals tweetsColor x tweetsHistogram diagram |
tweetsByTimeSpan := self collectMessages: [ self tweets] byTimeSpanSplits: aNumberOfBars.
subtotals := tweetsByTimeSpan values collect: [ :collection | collection size ].
tweetsColor := (Color r:(91/255) g:(131/255) b:(222/255)).
x := 1 to: subtotals size.
tweetsHistogram := RSChart new.
tweetsHistogram extent: 800@200.
diagram := RSBarPlot new x: x y:subtotals.
diagram color: tweetsColor.
tweetsHistogram addPlot: diagram.
tweetsHistogram addDecoration: (RSHorizontalTick new
fromNames: tweetsByTimeSpan keys;
labelRotation: 0;
fontSize: 80 /aNumberOfBars;
yourself).
tweetsHistogram addDecoration: (RSVerticalTick new
integer;
fontSize: 80 /aNumberOfBars).
tweetsHistogram build.
tweetsHistogram canvas pdfExporter
zoomToShapes;
noFixedShapes;
fileName: (self folder / 'trinos.pdf')fullName;
export.
^ self folder / 'trinos.pdf'