[reportlab-users] y axis label with 2.77555756156e-017

Robin Becker reportlab-users@reportlab.com
Fri, 19 Mar 2004 11:22:59 +0000


In article <000001c40da2$043df990$6ac9280a@domw2k.int>, Florian Reiser
<florian.reiser@ra-bc.de> writes
>Hello,
>
>when I draw a chart with the following data,
>then the y axis shows 2.77555756156e-017
>instead 0.0.
>
># Begin data
>[(0.0, 0.0, None, None, None, None, None, None, None, None, None, None),
>(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
>(-0.036819999999999999, -0.073639999999999997, -0.11046,
>-0.14727999999999999, -0.18410000000000001, -0.22092000000000001,
>-0.25774000000000002, -0.29455999999999999, -0.33138000000000001,
>-0.36820000000000003, -0.40501999999999999, -0.44186799999999998),
>(None, None, None, None, None, None, None, None, None, None, None, None),
>(-0.31759999999999999, -0.442, None, None, None, None, None, None, None,
>None, None, None),
>(None, None, None, None, None, None, None, None, None, None, None, None),
>(None, None, None, None, None, None, None, None, None, None, None, None)] 
># End data
>
>Other charts with similar data work fine.
>
>Why?

well we have to do calculations etc to get the ranges and I guess the
tick interval didn't exactly hit the 0 when starring from its minimum.
This will always be a problem as floating point arithmetic is like that.

Your current labels are produced by applying str to the values. Probably
you need to specify a format operation.

ie valueAxis.labelTextFormat = '%.2f' or similar
>With kind regards
>Florian Reiser
>
>
>_______________________________________________
>reportlab-users mailing list
>reportlab-users@reportlab.com
>http://two.pairlist.net/mailman/listinfo/reportlab-users
>

-- 
Robin Becker