Code

Testing an double and an integer for equality is bound to produce odd results on...
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Thu, 3 May 2007 12:43:15 +0000 (12:43 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Thu, 3 May 2007 12:43:15 +0000 (12:43 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1052 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_graph.c

index 69d68718aba761455fa12bf5147865146d2e02d0..aae131708b4cf5c483d53c72c6615180f973f3d7 100644 (file)
@@ -1673,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 ( round(Y0) >= im->yorigin-im->ysize 
+            && round(Y0) <= 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. */