Creating exporter for retweets.
This commit is contained in:
parent
e8373fab2c
commit
e43b375a6b
@ -0,0 +1,34 @@
|
||||
accessing
|
||||
exportRetweetsHistogram
|
||||
|
||||
| retweetsOccurrences labels retweetColor diagram x retweetsHistogram |
|
||||
|
||||
retweetsOccurrences := (self retweets messages collect: [ :tweet | tweet user userName ]) asBag contents asDictionary.
|
||||
retweetColor := (Color r:(217/255) g:(56/255) b: (124/255)).
|
||||
x := 1 to: retweetsOccurrences size.
|
||||
retweetsHistogram := RSChart new.
|
||||
retweetsHistogram extent: 800@200.
|
||||
diagram := RSBarPlot new x: x y: retweetsOccurrences values.
|
||||
diagram color: retweetColor.
|
||||
retweetsHistogram addPlot: diagram.
|
||||
retweetsHistogram addDecoration: (RSHorizontalTick new
|
||||
fromNames: labels;
|
||||
labelRotation: 0;
|
||||
fontSize: 80 /retweetsOccurrences size;
|
||||
yourself ).
|
||||
retweetsHistogram addDecoration: (RSVerticalTick new
|
||||
integer;
|
||||
fontSize: 80 /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'
|
Loading…
Reference in New Issue
Block a user