Le 21 mars 2015 01:01, "Peter Uhnák" <i.uhnak(a)gmail.com> a écrit :
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.
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).
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.
I think that a RTStackedDataset is not using x.
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"
Try number of labels instead.
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(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev