X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=2e9e0091117fb4500a96b77af3cde8003ff8e5f4;hb=77377ff6ac43512ee216af115a3e62c57a2484a3;hp=ea7ed0d2f6474a5ed389da6b6e4059efef951c3a;hpb=01399dbbb2b67d6fbe8d22eac1a1482f8efee461;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index ea7ed0d..2e9e009 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -181,7 +181,6 @@ enum gf_en gf_conv(char *string){ enum if_en if_conv(char *string){ - conv_if(GIF,IF_GIF) conv_if(PNG,IF_PNG) return (-1); @@ -816,6 +815,17 @@ printf("DEBUG: value from vdef is %f\n",im->gdes[ptr].vf.val); } /* if OP_VARIABLE */ } /* loop through all rpi */ + /* move the data pointers to the correct period */ + for(rpi=0;im->gdes[gdi].rpnp[rpi].op != OP_END;rpi++){ + if(im->gdes[gdi].rpnp[rpi].op == OP_VARIABLE){ + long ptr = im->gdes[gdi].rpnp[rpi].ptr; + if(im->gdes[gdi].start > im->gdes[ptr].start) { + im->gdes[gdi].rpnp[rpi].data += im->gdes[gdi].rpnp[rpi].ds_cnt; + } + } + } + + if(steparray == NULL){ rrd_set_error("rpn expressions without DEF" " or CDEF variables are not supported"); @@ -1713,17 +1723,22 @@ grid_paint( /* draw 3d border */ - node = gfx_new_area (canvas, 0,im->ygif, 0,0, im->xgif, 0,im->graph_col[GRC_SHADEA]); + node = gfx_new_area (canvas, 0,im->ygif, + 2,im->ygif-2, + 2,2,im->graph_col[GRC_SHADEA]); gfx_add_point( node , im->xgif - 2, 2 ); - gfx_add_point( node , 2,2 ); - gfx_add_point( node , 2,im->ygif-2 ); - gfx_add_point( node , 0,im->ygif ); + gfx_add_point( node , im->xgif, 0 ); + gfx_add_point( node , 0,0 ); +/* gfx_add_point( node , 0,im->ygif ); */ - node = gfx_new_area (canvas, 0,im->ygif, im->xgif,im->ygif, im->xgif,0,im->graph_col[GRC_SHADEB]); - gfx_add_point( node , im->xgif - 2, 2 ); - gfx_add_point( node , im->xgif-2,im->ygif-2 ); - gfx_add_point( node , 2,im->ygif-2 ); - gfx_add_point( node , 0,im->ygif ); + node = gfx_new_area (canvas, 2,im->ygif-2, + im->xgif-2,im->ygif-2, + im->xgif - 2, 2, + im->graph_col[GRC_SHADEB]); + gfx_add_point( node , im->xgif,0); + gfx_add_point( node , im->xgif,im->ygif); + gfx_add_point( node , 0,im->ygif); +/* gfx_add_point( node , 0,im->ygif ); */ if (im->draw_x_grid == 1 ) @@ -1775,15 +1790,15 @@ grid_paint( if(im->gdes[i].gf != GF_GPRINT && im->gdes[i].gf != GF_COMMENT){ x0 = im->gdes[i].leg_x; y0 = im->gdes[i].leg_y+1.0; - x1 = x0+boxH; + x1 = x0; x2 = x0+boxH; - x3 = x0; - y1 = y0; + x3 = x0+boxH; + y1 = y0+boxV; y2 = y0+boxV; - y3 = y0+boxV; + y3 = y0; node = gfx_new_area(canvas, x0,y0,x1,y1,x2,y2 ,im->gdes[i].col); gfx_add_point ( node, x3, y3 ); - gfx_add_point ( node, x0, y0 ); +/* gfx_add_point ( node, x0, y0 ); */ node = gfx_new_line(canvas, x0,y0,x1,y1 ,GRIDWIDTH, im->graph_col[GRC_FRAME]); gfx_add_point ( node, x2, y2 ); gfx_add_point ( node, x3, y3 ); @@ -1833,9 +1848,6 @@ int lazy_check(image_desc_t *im){ if ((fd = fopen(im->graphfile,"rb")) == NULL) return 0; /* the file does not exist */ switch (im->imgformat) { - case IF_GIF: - size = GifSize(fd,&(im->xgif),&(im->ygif)); - break; case IF_PNG: size = PngSize(fd,&(im->xgif),&(im->ygif)); break; @@ -1844,6 +1856,51 @@ int lazy_check(image_desc_t *im){ return size; } +void +pie_part(gfx_canvas_t *canvas, gfx_color_t color, + double PieCenterX, double PieCenterY, double Radius, + double startangle, double endangle) +{ + gfx_node_t *node; + double angle; + double step=M_PI/50; /* Number of iterations for the circle; + ** 10 is definitely too low, more than + ** 50 seems to be overkill + */ + + /* Strange but true: we have to work clockwise or else + ** anti aliasing nor transparency don't work. + ** + ** This test is here to make sure we do it right, also + ** this makes the for...next loop more easy to implement. + ** The return will occur if the user enters a negative number + ** (which shouldn't be done according to the specs) or if the + ** programmers do something wrong (which, as we all know, never + ** happens anyway :) + */ + if (endangle