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

37 lines
1.2 KiB
Smalltalk

accessing
exportRetweetsHistogram
| retweetsOccurrences labels retweetColor diagram retweetsHistogram |
retweetsOccurrences := self retweetsSortedByOccurrences.
retweetColor := (Color r:(217/255) g:(56/255) b: (124/255)).
labels := retweetsOccurrences keys.
labels := labels collect: [ :profiles | ('@', profiles) ].
retweetsHistogram := RSChart new.
retweetsHistogram extent: 800@200.
diagram := RSBarPlot new
x: (1 to: retweetsOccurrences size)
y: retweetsOccurrences values.
diagram color: retweetColor.
retweetsHistogram addPlot: diagram.
retweetsHistogram addDecoration: (RSHorizontalTick new
fromNames: labels;
labelRotation: 0;
fontSize: 72 /retweetsOccurrences size;
yourself).
retweetsHistogram addDecoration: (RSVerticalTick new
integer;
fontSize: 72 /retweetsOccurrences 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'