2022-04-20 21:27:54 +00:00
|
|
|
accessing
|
|
|
|
exportRetweetsHistogramWithBars: aNumberOfBars
|
|
|
|
|
2022-04-20 21:59:57 +00:00
|
|
|
| keysToRemove retweets labels retweetsHistogram diagram |
|
2022-04-20 21:27:54 +00:00
|
|
|
retweets := self retweetsSortedByOccurrences.
|
|
|
|
(aNumberOfBars > retweets size) ifTrue: [ ^ self exportRetweetsHistogram ].
|
|
|
|
keysToRemove := OrderedCollection new.
|
|
|
|
1 to: retweets size - aNumberOfBars do:
|
|
|
|
[ :i | keysToRemove add: (retweets keys at: i + aNumberOfBars) ].
|
|
|
|
retweets removeKeys: keysToRemove.
|
|
|
|
|
|
|
|
labels := retweets keys.
|
|
|
|
retweetsHistogram := RSChart new.
|
|
|
|
retweetsHistogram extent: 800@200.
|
2022-04-20 21:59:57 +00:00
|
|
|
diagram := RSBarPlot new
|
|
|
|
x: (1 to: retweets size)
|
|
|
|
y: retweets values.
|
2022-04-20 21:27:54 +00:00
|
|
|
diagram color: (Color r:(217/255) g:(56/255) b: (124/255)).
|
|
|
|
retweetsHistogram addPlot: diagram.
|
|
|
|
retweetsHistogram addDecoration: (RSHorizontalTick new
|
|
|
|
fromNames: labels;
|
|
|
|
labelRotation: 0;
|
|
|
|
fontSize: 80 /retweets size;
|
|
|
|
yourself).
|
|
|
|
retweetsHistogram addDecoration: (RSVerticalTick new
|
|
|
|
integer;
|
|
|
|
fontSize: 80 /retweets size).
|
|
|
|
retweetsHistogram build.
|
|
|
|
|
|
|
|
retweetsHistogram canvas pdfExporter
|
|
|
|
zoomToShapes;
|
|
|
|
noFixedShapes;
|
|
|
|
fileName: (self folder / 'retweets-histogram.pdf')fullName;
|
|
|
|
export.
|
|
|
|
retweetsHistogram canvas pngExporter
|
|
|
|
zoomToShapes;
|
|
|
|
noFixedShapes;
|
|
|
|
fileName: (self folder / 'retweets-histogram.png')fullName;
|
|
|
|
export.
|
|
|
|
^ self folder / 'retweets-histogram.png'
|