X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=bb4c542ec75fb95aa8b5413cfaf1a50faad2ce58;hb=199a103f8d08936f93c5864ea7bc0ba722fc6b5c;hp=3e7b1afa2ac6eb827f7e161656f47526eabed436;hpb=259b7bcc52854a8725ed0ad9a88218f3eb27e7fb;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 3e7b1af..bb4c542 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -1,5 +1,5 @@ /**************************************************************************** - * RRDtool 1.2.3 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); @@ -1961,7 +1963,7 @@ grid_paint(image_desc_t *im) /* rrdtool 'logo' */ gfx_new_text( im->canvas, im->ximg-7, 7, - ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000066, + ( im->graph_col[GRC_FONT] & 0xffffff00 ) | 0x00000044, im->text_prop[TEXT_PROP_AXIS].font, 5.5, im->tabwidth, 270, GFX_H_RIGHT, GFX_V_TOP, @@ -1987,30 +1989,38 @@ grid_paint(image_desc_t *im) if ( im->gdes[i].gf != GF_PRINT && im->gdes[i].gf != GF_GPRINT && im->gdes[i].gf != GF_COMMENT) { - int boxH, boxV; + int boxL, boxH, boxV; - boxH = gfx_get_text_width(im->canvas, 0, + boxL = gfx_get_text_width(im->canvas, 0, im->text_prop[TEXT_PROP_LEGEND].font, im->text_prop[TEXT_PROP_LEGEND].size, - im->tabwidth,"M", 0)*1.2; - boxV = boxH; + im->tabwidth,"oo", 0); + boxH = boxL / 1.9; + boxV = boxH+1; /* make sure transparent colors show up all the same */ + node = gfx_new_area(im->canvas, + X0-1,Y0-boxV, + X0-1,Y0+1, + X0+boxL+0.5,Y0+1, + im->graph_col[GRC_BACK]); + gfx_add_point ( node, X0+boxL+0.5, Y0-boxV ); node = gfx_new_area(im->canvas, - X0,Y0-boxV, - X0,Y0, + X0-1,Y0-boxV, + X0-1,Y0, X0+boxH,Y0, im->graph_col[GRC_CANVAS]); gfx_add_point ( node, X0+boxH, Y0-boxV ); node = gfx_new_area(im->canvas, - X0,Y0-boxV, - X0,Y0, + X0-1,Y0-boxV, + X0-1,Y0, X0+boxH,Y0, im->gdes[i].col); gfx_add_point ( node, X0+boxH, Y0-boxV ); node = gfx_new_line(im->canvas, - X0,Y0-boxV, X0,Y0, + X0-1,Y0-boxV, + X0-1,Y0, 1,im->graph_col[GRC_FONT]); gfx_add_point(node,X0+boxH,Y0); gfx_add_point(node,X0+boxH,Y0-boxV); @@ -2496,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;iixsize;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; } @@ -2521,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; } @@ -2531,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.2+(double)im->xorigin,ybase0-0.2, + (double)ii-1.2+(double)im->xorigin,ytop0+0.2, + (double)ii+0.2+(double)im->xorigin,ytop+0.2, im->gdes[i].col ); gfx_add_point(node, - ii+im->xorigin,ybase + (double)ii+0.02+im->xorigin,ybase-0.2 ); } ybase0=ybase; @@ -3102,6 +3112,22 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im) int ci; int col_len = col_end - col_start; switch (col_len){ + case 3: + color = ( + ((color & 0xF00) * 0x110000) | + ((color & 0x0F0) * 0x011000) | + ((color & 0x00F) * 0x001100) | + 0x000000FF + ); + break; + case 4: + color = ( + ((color & 0xF000) * 0x11000) | + ((color & 0x0F00) * 0x01100) | + ((color & 0x00F0) * 0x00110) | + ((color & 0x000F) * 0x00011) + ); + break; case 6: color = (color << 8) + 0xff /* shift left by 8 */; break;