[rrd-developers] Re: rrd_graph patch for nice log gridlines
Beat Zahnd
beat.zahnd at phim.unibe.ch
Mon Jun 16 09:08:21 MEST 2003
Beat Zahnd wrote:
>
> Is there some rounding in ytr().
>
There seems to be a problem with 'pixie' in ytr(). 'pixie' is only
defined if 'value' is a NAN?!?!
Regards, Beat
/* translate data values into y coordinates */
double
ytr(image_desc_t *im, double value){
static double pixie;
double yval;
if (isnan(value)){
if(!im->logarithmic)
pixie = (double) im->ysize / (im->maxval - im->minval);
else
pixie = (double) im->ysize / (log10(im->maxval) -
log10(im->minval));
yval = im->yorigin;
} else if(!im->logarithmic) {
yval = im->yorigin - pixie * (value - im->minval);
} else {
if (value < im->minval) {
yval = im->yorigin;
} else {
yval = im->yorigin - pixie * (log10(value) - log10(im->minval));
}
}
/* make sure we don't return anything too unreasonable. GD lib can
get terribly slow when drawing lines outside its scope. This is
especially problematic in connection with the rigid option */
if (! im->rigid) {
/* keep yval as-is */
} else if (yval > im->yorigin) {
yval = im->yorigin+2;
} else if (yval < im->yorigin - im->ysize){
yval = im->yorigin - im->ysize - 2;
}
return yval;
}
--
Beat ZAHND
Physics Institute
University of Bern phone +41 31 631 3466
Sidlerstrasse 5 fax +41 31 631 4405
CH-3012 Bern (Switzerland) mailto:beat.zahnd at phim.unibe.ch
http://www.phim.unibe.ch/rosina/rosina.html
http://rosetta.esa.int/
--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
More information about the rrd-developers
mailing list