Modifying date displays in histograms and fixing empty replies and quotes exporter.

This commit is contained in:
ruidajo 2022-05-02 22:31:41 -05:00
parent 6a628fddd3
commit 419aa176ab
4 changed files with 28 additions and 3 deletions

View File

@ -5,5 +5,6 @@ createdAt
joinDateString := joinDateString copyReplaceAll: '3 May' with: '03 May'.
joinDateString := joinDateString copyReplaceAll: '5 May' with: '05 May'.
joinDateString := joinDateString copyReplaceAll: '2 Feb' with: '02 Feb'.
joinDateString := joinDateString copyReplaceAll: '6 Mar' with: '06 Mar'.
createdAt := (ZTimestampFormat fromString:'4:05 PM - 03 Feb 2001') parse: joinDateString.
]

View File

@ -3,6 +3,17 @@ exportQuotesHistogram
| quotesOccurrences labels diagram quotesHistogram |
self quotes ifEmpty: [
quotesHistogram := RSChart new.
quotesHistogram extent: 800@200.
quotesHistogram build.
quotesHistogram canvas pdfExporter
zoomToShapes;
noFixedShapes;
fileName: (self folder / 'quotes-histogram.pdf')fullName;
export.
^ self
].
quotesOccurrences := self quotesSortedByOccurrences.
labels := quotesOccurrences keys.
labels := labels collect: [ :profiles | ('@', profiles) ].

View File

@ -2,7 +2,18 @@ accessing
exportRepliesHistogramWithBars: aNumberOfBars
| tweetsByTimeSpan subtotals tweetsHistogram diagram |
self replies ifEmpty: [
tweetsHistogram := RSChart new.
tweetsHistogram extent: 800@200.
tweetsHistogram build.
tweetsHistogram canvas pdfExporter
zoomToShapes;
noFixedShapes;
fileName: (self folder / 'replies-histogram.pdf')fullName;
export.
^ self
].
tweetsByTimeSpan := self collectMessages: [ self replies ] byTimeSpanSplits: aNumberOfBars.
subtotals := tweetsByTimeSpan values collect: [ :collection | collection size ].
tweetsHistogram := RSChart new.

View File

@ -2,8 +2,10 @@ accessing
collectMessages: aBlock byTimeSpanSplits: anInteger
| timespans spanLabels messagesByTimespan |
timespans := aBlock value timeSpansOf: anInteger.
spanLabels := (timespans collect: [ :timeSpan |
((timeSpan start asDate greaseString removeSuffix: '2022'), '→ ', timeSpan end asDate greaseString removeSuffix: '2022')
spanLabels := (timespans collect: [ :timeSpan | | start end |
start := (timeSpan start dayOfMonth) asString, ' ', ((timeSpan start monthName) asString copyFrom:1 to: 3).
end := (timeSpan end dayOfMonth) asString, ' ', ((timeSpan end monthName) asString copyFrom:1 to: 3).
start, '→ ', end
]) asArray.
messagesByTimespan := OrderedDictionary new.
spanLabels doWithIndex: [:label :i |