From e43b375a6b441c09616aad81a4f27b168fa64fb2 Mon Sep 17 00:00:00 2001 From: ruidajo Date: Tue, 19 Apr 2022 13:55:39 -0500 Subject: [PATCH] Creating exporter for retweets. --- .../instance/exportRetweetsHistogram.st | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Socialmetrica.package/NitterUser.class/instance/exportRetweetsHistogram.st diff --git a/Socialmetrica.package/NitterUser.class/instance/exportRetweetsHistogram.st b/Socialmetrica.package/NitterUser.class/instance/exportRetweetsHistogram.st new file mode 100644 index 0000000..732ae5c --- /dev/null +++ b/Socialmetrica.package/NitterUser.class/instance/exportRetweetsHistogram.st @@ -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' \ No newline at end of file