[rrd-developers] Re: rrd_graph patch for nice log gridlines
Tobias Oetiker
oetiker at ee.ethz.ch
Mon Jun 16 20:47:21 MEST 2003
Today Beat Zahnd wrote:
> 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?!?!
Hi Beat,
this is a trick
as you can see on line 2508 of rrd_graph.c there is an explicit
call to ytr with value NAN ... this is used to initialize pixie.
cheers
tobi
>
> 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;
> }
>
>
>
--
______ __ _
/_ __/_ / / (_) Oetiker @ ISG.EE, ETZ J97, ETH, CH-8092 Zurich
/ // _ \/ _ \/ / System Manager, Time Lord, Coder, Designer, Coach
/_/ \.__/_.__/_/ http://people.ee.ethz.ch/~oetiker +41(0)1-632-5286
--
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