X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=22439b5771f174ee0e885cacc28540b9c2d6286c;hb=5fc7ff89bdbced9c593c566fea9840a269935dcd;hp=e16e5d84ba60110a3c4070cbe9f6fa87a2735897;hpb=7f4dd5f9c0f20e4d6690685641a9cd8ea621da51;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index e16e5d8..22439b5 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2.20 Copyright by Tobi Oetiker, 1997-2007 + * RRDtool 1.2.23 Copyright by Tobi Oetiker, 1997-2007 **************************************************************************** * rrd__graph.c produce graphs from data in rrdfiles ****************************************************************************/ @@ -497,7 +497,10 @@ apply_gridfit(image_desc_t *im) double new_range = factor * (im->maxval - im->minval); double gridstep = im->ygrid_scale.gridstep; double minor_y, minor_y_px, minor_y_px_frac; - im->maxval = im->minval + new_range; + if (im->maxval > 0.0) + im->maxval = im->minval + new_range; + else + im->minval = im->maxval - new_range; ytr(im,DNAN); /* reset precalc */ /* make sure first minor gridline is on integer pixel y coord */ minor_y = gridstep * floor(im->minval / gridstep); @@ -1670,8 +1673,8 @@ int draw_horizontal_grid(image_desc_t *im) for (i = sgrid; i <= egrid; i++){ double Y0=ytr(im,im->ygrid_scale.gridstep*i); double YN=ytr(im,im->ygrid_scale.gridstep*(i+1)); - if ( Y0 >= im->yorigin-im->ysize - && Y0 <= im->yorigin){ + if ( floor(Y0+0.5) >= im->yorigin-im->ysize + && floor(Y0+0.5) <= im->yorigin){ /* Make sure at least 2 grid labels are shown, even if it doesn't agree with the chosen settings. Add a label if required by settings, or if there is only one label so far and the next grid line is out of bounds. */ @@ -1834,7 +1837,7 @@ horizontal_log_grid(image_desc_t *im) pre_value = value; Y0 = ytr(im, value); - if(Y0 <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* major grid line */ gfx_new_dashed_line ( im->canvas, @@ -1894,7 +1897,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(Y0 <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas, @@ -1910,7 +1913,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(Y0 <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas, @@ -1951,7 +1954,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(Y0 <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas, @@ -1968,7 +1971,7 @@ horizontal_log_grid(image_desc_t *im) if(value < im->minval) continue; Y0 = ytr(im, value); - if(Y0 <= im->yorigin - im->ysize) break; + if(floor(Y0+0.5) <= im->yorigin - im->ysize) break; /* draw lines */ gfx_new_dashed_line ( im->canvas,