Le 23 mars 2015 18:58, "Alexandre Bergel" alexandre.bergel@me.com a écrit :
Hi!
You are using an histogram. I think I should disable having labels on the
X-axis with histogram.
No, you shouldn't. I use that for dates. Well, I am going to use a decoration as you told me for my use case but this is the same. We need more control on where the labels are going.
Phil
Currently, you can have:
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= data := {1->0.3024011554432208. 2->24.359090088463624.
3->17.660001805380034. 4->12.111843293013179. 5->7.624345549738219. 6->5.985963170247337. 7->4.740250947824517. 8->3.837560931576097. 9->3.0691460552446292. 10->2.819777938256003. 11->2.3334536920021667. 12->1.9915598483480772. 13->1.6970572305470302. 14->1.3089005235602094. 15->1.1847806463260515. 16->1.0640458566528253. 17->0.8891496660046939. 18->0.7244087380393573. 19->0.670247337064452. 20->0.5878768730817837}.
y := [ :pair | (data select: [ :each | each key <= pair key ]) inject: 0
into: [:sum :item | sum + item value ]].
b := RTGrapher new. b extent: 500 @ 400.
ds := RTStackedDataSet new. ds points: data. ds histogramWithBarTitle: #key rotation: 0. ds y: y. ds barShape. ds highlightIf: [ :pair | true ] using: [ :pair | (y value: pair)
roundTo: 1 ].
b add: ds.
ds := RTStackedDataSet new. ds connectColor: Color green. ds points: data. ds connectColor: Color green. ds y: y. b add: ds.
b axisX noLabel; noTick; title: 'method size (LOC)'. b axisY noDecimal; title: '% share'. b build.
lb := RTLegendBuilder new. lb view: b view. lb addColor: Color green text: 'Method size distribution'. lb build.
b view
No tick and no label on the X-axis. However, you titled bar in your
stacked data set.
If you are working with distribution, I highly suggest you to work with
RTDistribution. This class is far from being finished. But I need help on this. You can then do:
((CompiledMethod allInstances copyFrom: 1 to: 100) collect:
#numberOfLinesOfCode) plotFrequency
Which produces something like:
So yes, most methods are very short :-)
Let us know how it goes
Cheers, Alexandre -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
On Mar 20, 2015, at 9:01 PM, Peter Uhnák i.uhnak@gmail.com wrote:
Hi!
Seeing your other (Grapher charting engine) post I wanted to look at it
and it looks interesting. :)
However I've encountered weird behavior - maybe because I'm not using in
correctly.
When you look at the bar chars they do not line up with the tick numbers
at bottom.
<2015-03-21_00:54:28.png> I have explicitly specified number of ticks (20). Interestingly if I
change it (to 30) then it lines up but is moved to left by one (starts at zero instead of one - just by changing numberOfTicks).
<2015-03-21_00:55:23.png>
Here is the script I used to create it (the data is generated from
another script)
================================ data := {1->0.3024011554432208. 2->24.359090088463624.
3->17.660001805380034. 4->12.111843293013179. 5->7.624345549738219. 6->5.985963170247337. 7->4.740250947824517. 8->3.837560931576097. 9->3.0691460552446292. 10->2.819777938256003. 11->2.3334536920021667. 12->1.9915598483480772. 13->1.6970572305470302. 14->1.3089005235602094. 15->1.1847806463260515. 16->1.0640458566528253. 17->0.8891496660046939. 18->0.7244087380393573. 19->0.670247337064452. 20->0.5878768730817837}.
y := [ :pair | (data select: [ :each | each key <= pair key ]) inject: 0
into: [:sum :item | sum + item value ]].
b := RTGrapher new. b extent: 500 @ 400.
ds := RTStackedDataSet new. ds points: data. ds x: #key. ds y: y. ds barShape. b add: ds.
ds2 := RTStackedDataSet new. ds2 points: data. ds2 x: #key. ds2 y: y. ds2 connectColor: Color green. ds2 highlightIf: [ :pair | true ] using: [ :pair | (y value: pair)
roundTo: 1 ].
b add: ds2.
b axisX noDecimal; numberOfTicks: 20; "<- change to 30 to break it" title: 'method size (LOC)'. b axisY noDecimal; title: '% share'. b build.
lb := RTLegendBuilder new. lb view: b view. lb addColor: Color green text: 'Method size distribution'. lb build.
b view open.
It's also amazing that 1/4 of all Pharo code is in two-line methods;
that's including the method name. :)
Peter _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev