X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=166d5624ccaa60c7e20d400a4e302825e1717bb9;hb=d252a95b51aac07904ec27dde793826894ba8ad9;hp=5597c496b6a53cf2584a49527ba8445dcdd70e6c;hpb=5f0b2514b520896d2b327cd60156ca4517d90ac8;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index 5597c49..166d562 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -174,6 +174,7 @@ enum gf_en gf_conv(char *string){ conv_if(DEF,GF_DEF) conv_if(CDEF,GF_CDEF) conv_if(VDEF,GF_VDEF) + conv_if(PART,GF_PART) return (-1); } @@ -815,6 +816,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"); @@ -937,6 +949,7 @@ data_proc( image_desc_t *im ){ case GF_DEF: case GF_CDEF: case GF_VDEF: + case GF_PART: break; } } @@ -1209,6 +1222,7 @@ print_calc(image_desc_t *im, char ***prdata) case GF_LINE: case GF_AREA: case GF_TICK: + case GF_PART: case GF_STACK: case GF_HRULE: case GF_VRULE: @@ -1324,9 +1338,6 @@ leg_place(image_desc_t *im) continue; im->gdes[ii].leg_x = leg_x; im->gdes[ii].leg_y = leg_y; -printf("DEBUG: using font %s with width %lf\n", - im->text_prop[TEXT_PROP_LEGEND].font, - im->text_prop[TEXT_PROP_LEGEND].size); leg_x += gfx_get_text_width(leg_x,im->text_prop[TEXT_PROP_LEGEND].font, im->text_prop[TEXT_PROP_LEGEND].size, @@ -1713,17 +1724,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 +1791,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 ); @@ -1844,6 +1860,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