Refactoring: minor changes in histogram exporters.
This commit is contained in:
parent
57adfca53a
commit
f66d93e2ca
@ -1,14 +1,15 @@
|
|||||||
accessing
|
accessing
|
||||||
exportQuotesHistogram
|
exportQuotesHistogram
|
||||||
|
|
||||||
| quotesOccurrences labels diagram x quotesHistogram |
|
| quotesOccurrences labels diagram quotesHistogram |
|
||||||
|
|
||||||
quotesOccurrences := self quotesSortedByOccurrences.
|
quotesOccurrences := self quotesSortedByOccurrences.
|
||||||
x := 1 to: quotesOccurrences size.
|
|
||||||
labels := quotesOccurrences keys.
|
labels := quotesOccurrences keys.
|
||||||
quotesHistogram := RSChart new.
|
quotesHistogram := RSChart new.
|
||||||
quotesHistogram extent: 800@200.
|
quotesHistogram extent: 800@200.
|
||||||
diagram := RSBarPlot new x: x y: quotesOccurrences values.
|
diagram := RSBarPlot new
|
||||||
|
x: (1 to: quotesOccurrences size)
|
||||||
|
y: quotesOccurrences values.
|
||||||
diagram color: (Color r:(89/255) g:(217/255) b:(95/255)).
|
diagram color: (Color r:(89/255) g:(217/255) b:(95/255)).
|
||||||
quotesHistogram addPlot: diagram.
|
quotesHistogram addPlot: diagram.
|
||||||
quotesHistogram addDecoration: (RSHorizontalTick new
|
quotesHistogram addDecoration: (RSHorizontalTick new
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
accessing
|
accessing
|
||||||
exportQuotesHistogramWithBars: aNumberOfBars
|
exportQuotesHistogramWithBars: aNumberOfBars
|
||||||
|
|
||||||
| keysToRemove quotes x labels quotesHistogram diagram |
|
| keysToRemove quotes labels quotesHistogram diagram |
|
||||||
quotes := self quotesSortedByOccurrences.
|
quotes := self quotesSortedByOccurrences.
|
||||||
(aNumberOfBars > quotes size) ifTrue: [ ^ self exportQuotesHistogram ].
|
(aNumberOfBars > quotes size) ifTrue: [ ^ self exportQuotesHistogram ].
|
||||||
keysToRemove := OrderedCollection new.
|
keysToRemove := OrderedCollection new.
|
||||||
@ -9,11 +9,12 @@ exportQuotesHistogramWithBars: aNumberOfBars
|
|||||||
[ :i | keysToRemove add: (quotes keys at: i + aNumberOfBars) ].
|
[ :i | keysToRemove add: (quotes keys at: i + aNumberOfBars) ].
|
||||||
quotes removeKeys: keysToRemove.
|
quotes removeKeys: keysToRemove.
|
||||||
|
|
||||||
x := 1 to: quotes size.
|
|
||||||
labels := quotes keys.
|
labels := quotes keys.
|
||||||
quotesHistogram := RSChart new.
|
quotesHistogram := RSChart new.
|
||||||
quotesHistogram extent: 800@200.
|
quotesHistogram extent: 800@200.
|
||||||
diagram := RSBarPlot new x: x y: quotes values.
|
diagram := RSBarPlot new
|
||||||
|
x: (1 to: quotes size)
|
||||||
|
y: quotes values.
|
||||||
diagram color: (Color r:(89/255) g:(217/255) b:(95/255)).
|
diagram color: (Color r:(89/255) g:(217/255) b:(95/255)).
|
||||||
quotesHistogram addPlot: diagram.
|
quotesHistogram addPlot: diagram.
|
||||||
quotesHistogram addDecoration: (RSHorizontalTick new
|
quotesHistogram addDecoration: (RSHorizontalTick new
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
accessing
|
accessing
|
||||||
exportRepliesHistogramWithBars: aNumberOfBars
|
exportRepliesHistogramWithBars: aNumberOfBars
|
||||||
|
|
||||||
| tweetsByTimeSpan subtotals repliesColor x tweetsHistogram diagram |
|
| tweetsByTimeSpan subtotals tweetsHistogram diagram |
|
||||||
|
|
||||||
tweetsByTimeSpan := self collectMessages: [ self replies ] byTimeSpanSplits: aNumberOfBars.
|
tweetsByTimeSpan := self collectMessages: [ self replies ] byTimeSpanSplits: aNumberOfBars.
|
||||||
subtotals := tweetsByTimeSpan values collect: [ :collection | collection size ].
|
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 := RSChart new.
|
||||||
tweetsHistogram extent: 800@200.
|
tweetsHistogram extent: 800@200.
|
||||||
diagram := RSBarPlot new x: x y:subtotals.
|
diagram := RSBarPlot new
|
||||||
diagram color: repliesColor.
|
x: (1 to: subtotals size)
|
||||||
|
y:subtotals.
|
||||||
|
diagram color: (Color r:(246/255) g:(185/255) b:(46/255)).
|
||||||
tweetsHistogram addPlot: diagram.
|
tweetsHistogram addPlot: diagram.
|
||||||
tweetsHistogram addDecoration: (RSHorizontalTick new
|
tweetsHistogram addDecoration: (RSHorizontalTick new
|
||||||
fromNames: tweetsByTimeSpan keys;
|
fromNames: tweetsByTimeSpan keys;
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
accessing
|
accessing
|
||||||
exportRetweetsHistogram
|
exportRetweetsHistogram
|
||||||
|
|
||||||
| retweetsOccurrences labels retweetColor diagram x retweetsHistogram |
|
| retweetsOccurrences labels retweetColor diagram retweetsHistogram |
|
||||||
|
|
||||||
retweetsOccurrences := self retweetsSortedByOccurrences.
|
retweetsOccurrences := self retweetsSortedByOccurrences.
|
||||||
retweetColor := (Color r:(217/255) g:(56/255) b: (124/255)).
|
retweetColor := (Color r:(217/255) g:(56/255) b: (124/255)).
|
||||||
x := 1 to: retweetsOccurrences size.
|
|
||||||
labels := retweetsOccurrences keys.
|
labels := retweetsOccurrences keys.
|
||||||
retweetsHistogram := RSChart new.
|
retweetsHistogram := RSChart new.
|
||||||
retweetsHistogram extent: 800@200.
|
retweetsHistogram extent: 800@200.
|
||||||
diagram := RSBarPlot new x: x y: retweetsOccurrences values.
|
diagram := RSBarPlot new
|
||||||
|
x: (1 to: retweetsOccurrences size)
|
||||||
|
y: retweetsOccurrences values.
|
||||||
diagram color: retweetColor.
|
diagram color: retweetColor.
|
||||||
retweetsHistogram addPlot: diagram.
|
retweetsHistogram addPlot: diagram.
|
||||||
retweetsHistogram addDecoration: (RSHorizontalTick new
|
retweetsHistogram addDecoration: (RSHorizontalTick new
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
accessing
|
accessing
|
||||||
exportRetweetsHistogramWithBars: aNumberOfBars
|
exportRetweetsHistogramWithBars: aNumberOfBars
|
||||||
|
|
||||||
| keysToRemove retweets x labels retweetsHistogram diagram |
|
| keysToRemove retweets labels retweetsHistogram diagram |
|
||||||
retweets := self retweetsSortedByOccurrences.
|
retweets := self retweetsSortedByOccurrences.
|
||||||
(aNumberOfBars > retweets size) ifTrue: [ ^ self exportRetweetsHistogram ].
|
(aNumberOfBars > retweets size) ifTrue: [ ^ self exportRetweetsHistogram ].
|
||||||
keysToRemove := OrderedCollection new.
|
keysToRemove := OrderedCollection new.
|
||||||
@ -9,11 +9,12 @@ exportRetweetsHistogramWithBars: aNumberOfBars
|
|||||||
[ :i | keysToRemove add: (retweets keys at: i + aNumberOfBars) ].
|
[ :i | keysToRemove add: (retweets keys at: i + aNumberOfBars) ].
|
||||||
retweets removeKeys: keysToRemove.
|
retweets removeKeys: keysToRemove.
|
||||||
|
|
||||||
x := 1 to: retweets size.
|
|
||||||
labels := retweets keys.
|
labels := retweets keys.
|
||||||
retweetsHistogram := RSChart new.
|
retweetsHistogram := RSChart new.
|
||||||
retweetsHistogram extent: 800@200.
|
retweetsHistogram extent: 800@200.
|
||||||
diagram := RSBarPlot new x: x y: retweets values.
|
diagram := RSBarPlot new
|
||||||
|
x: (1 to: retweets size)
|
||||||
|
y: retweets values.
|
||||||
diagram color: (Color r:(217/255) g:(56/255) b: (124/255)).
|
diagram color: (Color r:(217/255) g:(56/255) b: (124/255)).
|
||||||
retweetsHistogram addPlot: diagram.
|
retweetsHistogram addPlot: diagram.
|
||||||
retweetsHistogram addDecoration: (RSHorizontalTick new
|
retweetsHistogram addDecoration: (RSHorizontalTick new
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
accessing
|
accessing
|
||||||
exportTweetsHistogramWithBars: aNumberOfBars
|
exportTweetsHistogramWithBars: aNumberOfBars
|
||||||
|
|
||||||
| tweetsByTimeSpan subtotals tweetsColor x tweetsHistogram diagram |
|
| tweetsByTimeSpan subtotals tweetsHistogram diagram |
|
||||||
|
|
||||||
tweetsByTimeSpan := self collectMessages: [ self tweets] byTimeSpanSplits: aNumberOfBars.
|
tweetsByTimeSpan := self collectMessages: [ self tweets] byTimeSpanSplits: aNumberOfBars.
|
||||||
subtotals := tweetsByTimeSpan values collect: [ :collection | collection size ].
|
subtotals := tweetsByTimeSpan values collect: [ :collection | collection size ].
|
||||||
tweetsColor := (Color r:(91/255) g:(131/255) b:(222/255)).
|
|
||||||
x := 1 to: subtotals size.
|
|
||||||
tweetsHistogram := RSChart new.
|
tweetsHistogram := RSChart new.
|
||||||
tweetsHistogram extent: 800@200.
|
tweetsHistogram extent: 800@200.
|
||||||
diagram := RSBarPlot new x: x y:subtotals.
|
diagram := RSBarPlot new
|
||||||
diagram color: tweetsColor.
|
x: (1 to: subtotals size)
|
||||||
|
y:subtotals.
|
||||||
|
diagram color: (Color r:(91/255) g:(131/255) b:(222/255)).
|
||||||
tweetsHistogram addPlot: diagram.
|
tweetsHistogram addPlot: diagram.
|
||||||
tweetsHistogram addDecoration: (RSHorizontalTick new
|
tweetsHistogram addDecoration: (RSHorizontalTick new
|
||||||
fromNames: tweetsByTimeSpan keys;
|
fromNames: tweetsByTimeSpan keys;
|
||||||
|
Loading…
Reference in New Issue
Block a user