First draft to limit the reporting period. Future ones should have a TweetsCollection property to define such limits.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2022-05-03 23:08:54 -05:00
parent a2d5d80e57
commit 4abb9fe987
3 changed files with 38 additions and 1 deletions

View File

@ -4,7 +4,7 @@ exportOverviewReportLatex
self
exportDefaultReport;
externalWordCloud;
exportTweetsHistogramWithBars: 7;
exportTweetsHistogramWithBars: 7 between: 'March 13 2022' and: 'May 1 2022';
exportRetweetsHistogramWithBars: 7;
exportRepliesHistogramWithBars: 7;
exportQuotesHistogramWithBars: 7.

View File

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

View File

@ -0,0 +1,3 @@
accessing
tweetsBetween: startDate and: endDate
^ self tweets select: [ :each | each created between: startDate asDate and: endDate asDate ]