Creating replies and retweets filtering and modifying histograms.
This commit is contained in:
parent
bfa2a2ab99
commit
8d87ee3ed7
@ -0,0 +1,29 @@
|
||||
accessing
|
||||
exportRepliesHistogramWithBars: aNumberOfBars
|
||||
|
||||
| tweetsByTimeSpan subtotals repliesColor x tweetsHistogram diagram |
|
||||
|
||||
tweetsByTimeSpan := self collectMessages: [ self replies ] byTimeSpanSplits: aNumberOfBars.
|
||||
subtotals := tweetsByTimeSpan values collect: [ :collection | collection size ].
|
||||
repliesColor := (Color r:(246/255) g:(185/255) b:(46/255)).
|
||||
x := 1 to: subtotals size.
|
||||
tweetsHistogram := RSChart new.
|
||||
tweetsHistogram extent: 800@200.
|
||||
diagram := RSBarPlot new x: x y:subtotals.
|
||||
diagram color: repliesColor.
|
||||
tweetsHistogram addPlot: diagram.
|
||||
tweetsHistogram addDecoration: (RSHorizontalTick new
|
||||
fromNames: tweetsByTimeSpan keys;
|
||||
labelRotation: 0;
|
||||
fontSize: 80 /aNumberOfBars;
|
||||
yourself).
|
||||
tweetsHistogram addDecoration: (RSVerticalTick new
|
||||
integer;
|
||||
fontSize: 80 /aNumberOfBars).
|
||||
tweetsHistogram build.
|
||||
tweetsHistogram canvas pngExporter
|
||||
zoomToShapes;
|
||||
noFixedShapes;
|
||||
fileName: (self folder / 'replies-histogram.png')fullName;
|
||||
export.
|
||||
^ self folder / 'replies-histogram.png'
|
@ -21,9 +21,9 @@ exportTweetsHistogramWithBars: aNumberOfBars
|
||||
integer;
|
||||
fontSize: 80 /aNumberOfBars).
|
||||
tweetsHistogram build.
|
||||
tweetsHistogram canvas pdfExporter
|
||||
tweetsHistogram canvas pngExporter
|
||||
zoomToShapes;
|
||||
noFixedShapes;
|
||||
fileName: (self folder / 'trinos.pdf')fullName;
|
||||
fileName: (self folder / 'tweets-histogram.png')fullName;
|
||||
export.
|
||||
^ self folder / 'trinos.pdf'
|
||||
^ self folder / 'tweets-histogram.png'
|
@ -0,0 +1,7 @@
|
||||
accessing
|
||||
replies
|
||||
|
||||
self messages ifEmpty: [ self getMessages ].
|
||||
^ TweetsCollection new
|
||||
messages: (self messages messages select: [ :each | (each metadata at: 'replie to') isNotEmpty ]);
|
||||
yourself
|
@ -0,0 +1,7 @@
|
||||
accessing
|
||||
retweets
|
||||
|
||||
self messages ifEmpty: [ self getMessages ].
|
||||
^ TweetsCollection new
|
||||
messages: (self messages messages select: [ :each | each authorId ~= self id]);
|
||||
yourself
|
@ -1,6 +1,6 @@
|
||||
accessing
|
||||
tweets
|
||||
self messages messages ifEmpty: [ self getMessages ].
|
||||
self messages ifEmpty: [ self getMessages ].
|
||||
^ TweetsCollection new
|
||||
messages: (self messages messages select: [ :each | each authorId = self id ]);
|
||||
yourself
|
@ -1,4 +1,5 @@
|
||||
accessing
|
||||
created
|
||||
(created endsWith: 'GMT') ifTrue: [ ^ DateAndTime fromString: ((created splitOn: $,) second withoutSuffix: 'GMT') ].
|
||||
^ DateAndTime fromString: created
|
||||
created class = DateAndTime ifTrue: [ ^ created ].
|
||||
^ (created endsWith: 'GMT') ifTrue: [ ^ DateAndTime fromString: ((created splitOn: $,) second withoutSuffix: 'GMT') ].
|
||||
"^ DateAndTime fromString: created"
|
@ -0,0 +1,9 @@
|
||||
accessing
|
||||
ifEmpty: aBlock
|
||||
"Evaluate the given block, answering its value if the receiver is empty, otherwise answer the receiver."
|
||||
|
||||
"Note that the fact that this method returns its receiver in case the receiver is not empty allows one to write expressions like the following ones: self classifyMethodAs: (myProtocol ifEmpty: ['As yet unclassified'])"
|
||||
|
||||
^ self isEmpty
|
||||
ifTrue: [ aBlock value ]
|
||||
ifFalse: [ self ]
|
@ -0,0 +1,5 @@
|
||||
accessing
|
||||
isEmpty
|
||||
"Answer whether the receiver contains any elements."
|
||||
|
||||
^self size = 0
|
Loading…
Reference in New Issue
Block a user