make the areas that makeup the graphs a little larger, so that they overlap a bit
[rrdtool.git] / src / rrd_graph.c
index 2fae258..3a39ae2 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * RRDtool 1.2.4  Copyright by Tobi Oetiker, 1997-2005
+ * RRDtool 1.2.6  Copyright by Tobi Oetiker, 1997-2005
  ****************************************************************************
  * rrd__graph.c  produce graphs from data in rrdfiles
  ****************************************************************************/
@@ -1614,14 +1614,16 @@ int draw_horizontal_grid(image_desc_t *im)
    
     int sgrid = (int)( im->minval / im->ygrid_scale.gridstep - 1);
     int egrid = (int)( im->maxval / im->ygrid_scale.gridstep + 1);
+    double MaxY;
     scaledstep = im->ygrid_scale.gridstep/im->magfact;
+    MaxY = scaledstep*(double)im->viewfactor*(double)egrid;
     for (i = sgrid; i <= egrid; i++){
        double Y0=ytr(im,im->ygrid_scale.gridstep*i);
        if ( Y0 >= im->yorigin-im->ysize
                 && Y0 <= im->yorigin){       
            if(i % im->ygrid_scale.labfact == 0){               
                if (i==0 || im->symbol == ' ') {
-                   if(scaledstep < 1){
+                   if(MaxY < 10) {
                        if(im->extra_flags & ALTYGRID) {
                            sprintf(graph_label,im->ygrid_scale.labfmt,scaledstep*im->viewfactor*i);
                        }
@@ -1632,7 +1634,7 @@ int draw_horizontal_grid(image_desc_t *im)
                        sprintf(graph_label,"%4.0f",scaledstep*im->viewfactor*i);
                    }
                }else {
-                   if(scaledstep < 1){
+                   if(MaxY < 10){
                        sprintf(graph_label,"%4.1f %c",scaledstep*im->viewfactor*i, im->symbol);
                    } else {
                        sprintf(graph_label,"%4.0f %c",scaledstep*im->viewfactor*i, im->symbol);
@@ -2504,11 +2506,11 @@ graph_paint(image_desc_t *im, char ***calcpr)
 
           }
         } else {
-         float ybase0 = DNAN,ytop0=DNAN;
+         double ybase0 = DNAN,ytop0=DNAN;
           for(ii=0;ii<im->xsize;ii++){
            /* keep things simple for now, just draw these bars
               do not try to build a big and complex area */
-           float ybase,ytop;
+           double ybase,ytop;
            if ( im->slopemode == 0 && ii==0){
                continue;
            }
@@ -2529,7 +2531,7 @@ graph_paint(image_desc_t *im, char ***calcpr)
            /* every area has to be wound clock-wise,
               so we have to make sur base remains base  */             
            if (ybase > ytop){
-               float extra = ytop;
+               double extra = ytop;
                ytop = ybase;
                ybase = extra;
            }
@@ -2539,13 +2541,13 @@ graph_paint(image_desc_t *im, char ***calcpr)
            }
            if ( !isnan(ybase0) ){
                    node = gfx_new_area(im->canvas,
-                                ii-1+im->xorigin,ybase0,
-                                ii-1+im->xorigin,ytop0,
-                                ii+im->xorigin,ytop,                           
+                                (double)ii-1.1+(double)im->xorigin,ybase0-0.1,
+                                (double)ii-1.1+(double)im->xorigin,ytop0+0.1,
+                                (double)ii+0.1+(double)im->xorigin,ytop+0.1,
                                 im->gdes[i].col
                                );
                    gfx_add_point(node,
-                               ii+im->xorigin,ybase
+                               (double)ii+0.01+im->xorigin,ybase-0.1
                               );
             }
            ybase0=ybase;