[rrd-users] Re: alt-y-mrtg rrdgraph option problem?

Kees Hoekzema kees at tweakers.net
Sat Dec 28 14:56:50 MET 2002


Hello,

I had the same problem, and fixed it very dirty ;)
On line 372 in rrd_graph.c (using 1.0.39 source) there is a line that says

 double scaledstep = ceil(25 * pow((double)10,-decimals) * im->maxval) * 
 pow((double)10,decimals - 2);

This line is causing the problem, I noticed that sometimes 
'25 * pow((double)10,-decimals) * im->maxval' won't return a whole value, 
but something like 12.0000000001. and when you ceil that it will be 13 
and not 12.

I solved it by extracting 0.0001 before the ceil:

 double scaledstep = ceil((25 * pow((double)10, -decimals) * im->maxval) 
 - 0.0001) * pow((double)10,decimals - 2);

This is dirty, but hey, it works ;)

-kees

> -----Original Message-----
> From: rrd-users-bounce at list.ee.ethz.ch
> [mailto:rrd-users-bounce at list.ee.ethz.ch]On Behalf Of Kingsley Foreman
> Sent: Saturday, December 28, 2002 4:47 AM
> To: rrd-users at list.ee.ethz.ch
> Subject: [rrd-users] Re: alt-y-mrtg rrdgraph option problem?
> 
> 
> 
> I have aslo got this problem
> Ive found what is happening is that it is putting the incorrect scale on
> the side, The graph is correct but it the scale is adding 1 to its
> multiplier
> 
> eg if the peak should be 48 then it is 4x12 but the scaledstep thinks it
> should be 4x13
> 
> im think it is somewhere in the rrd_graph.c file but my c++ maths is no
> where near
> good enough to actually be able to fix it
> 
> Anyone else want to look at this problem
> 
> 
> Kingsley
> 

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list