Integer values on axis Y [solution]

9 views
Skip to first unread message

keemor

unread,
Mar 8, 2010, 8:36:39 AM3/8/10
to pycha
Hello,
Hi,

If tickprecision is set to 0 for axis Y, values (at least for me)
should be integer not with floating point .0

In pycha/chart.py after line 284 I added:
yval = (round(yval, prec),int(yval))[prec==0]
self.yticks.append((pos, yval))

so it looks like:

for i in range(self.options.axis.y.tickCount + 1):
yval = self.minyval + (i * roughSeparation)
pos = 1.0 - ((yval - self.minyval) * self.yscale)
if 0.0 <= pos <= 1.0:
yval = (round(yval, prec),int(yval))[prec==0]
self.yticks.append((pos, yval))


I'm not sure If it's 100% good, but it works for me.
Pycha rocks!

Greetz
--
keemor

Lorenzo Gil Sanchez

unread,
Mar 27, 2010, 4:26:29 AM3/27/10
to py...@googlegroups.com
2010/3/8 keemor <kee...@gmail.com>:
> Hello,
> Hi,
>
Hello

> If tickprecision is set to 0 for axis Y, values (at least for me)
> should be integer not with floating point .0
>

Sounds good

> In pycha/chart.py after line 284 I added:
> yval = (round(yval, prec),int(yval))[prec==0]
> self.yticks.append((pos, yval))
>
> so it looks like:
>
>            for i in range(self.options.axis.y.tickCount + 1):
>                yval = self.minyval + (i * roughSeparation)
>                pos = 1.0 - ((yval - self.minyval) * self.yscale)
>                if 0.0 <= pos <= 1.0:
>                    yval = (round(yval, prec),int(yval))[prec==0]
>                    self.yticks.append((pos, yval))
>
>
> I'm not sure If it's 100% good, but it works for me.

I just commited a slightly different version very similar to yours but
also handle other cases.

> Pycha rocks!

Thanks a lot and thanks for your contribution!

Best regards,

Lorenzo

Reply all
Reply to author
Forward
0 new messages