X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_graph.c;h=240e96f7cb48e673f61a51afd1ba2f8165190059;hb=28c7a05de0b7be52a9b3521aa677c44e9cc8260d;hp=c79248fcf9cb0bf4ec3f2f45e42ab1c45163d923;hpb=8ce4b39d191d7d993e913a988cdf6ed082bd8e7a;p=rrdtool.git diff --git a/src/rrd_graph.c b/src/rrd_graph.c index c79248f..240e96f 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -91,8 +91,7 @@ xlab_t xlab[] = { , {3600, 0, TMT_DAY, 1, TMT_WEEK, 1, TMT_WEEK, 1, 7 * 24 * 3600, week_fmt} , - {3 * 3600, 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_WEEK, 2, 7 * 24 * 3600, - week_fmt} + {3 * 3600, 0, TMT_WEEK, 1, TMT_MONTH, 1, TMT_WEEK, 2, 7 * 24 * 3600, week_fmt} , {6 * 3600, 0, TMT_MONTH, 1, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600, "%b"} @@ -257,6 +256,11 @@ enum gfx_if_en if_conv( conv_if(SVG, IF_SVG); conv_if(EPS, IF_EPS); conv_if(PDF, IF_PDF); + conv_if(XML, IF_XML); + conv_if(CSV, IF_CSV); + conv_if(TSV, IF_TSV); + conv_if(SSV, IF_SSV); + conv_if(JSON, IF_JSON); return (enum gfx_if_en)(-1); } @@ -413,8 +417,11 @@ void auto_scale( } } +/* power prefixes */ static char si_symbol[] = { + 'y', /* 10e-24 Yocto */ + 'z', /* 10e-21 Zepto */ 'a', /* 10e-18 Atto */ 'f', /* 10e-15 Femto */ 'p', /* 10e-12 Pico */ @@ -428,8 +435,10 @@ static char si_symbol[] = { 'T', /* 10e12 Tera */ 'P', /* 10e15 Peta */ 'E', /* 10e18 Exa */ + 'Z', /* 10e21 Zeta */ + 'Y' /* 10e24 Yotta */ }; -static const int si_symbcenter = 6; +static const int si_symbcenter = 8; /* find SI magnitude symbol for the numbers on the y-axis*/ void si_unit( @@ -1786,6 +1795,7 @@ int leg_place( prt_fctn != 'j' && prt_fctn != 'c' && prt_fctn != 'u' && + prt_fctn != '.' && prt_fctn != 's' && prt_fctn != '\0' && prt_fctn != 'g') { free(legspace); rrd_set_error @@ -1797,6 +1807,10 @@ int leg_place( if (prt_fctn == 'n') { prt_fctn = 'l'; } + /* \. is a null operation to allow strings ending in \x */ + if (prt_fctn == '.') { + prt_fctn = '\0'; + } /* remove exess space from the end of the legend for \g */ while (prt_fctn == 'g' && @@ -2943,6 +2957,7 @@ int graph_size_location( im->ximg = im->xsize; im->yimg = im->ysize; im->yorigin = im->ysize; + xtr(im, 0); ytr(im, DNAN); return 0; } @@ -3395,6 +3410,12 @@ int graph_paint( cairo_svg_surface_restrict_to_version (im->surface, CAIRO_SVG_VERSION_1_1); break; + case IF_XML: + case IF_CSV: + case IF_TSV: + case IF_SSV: + case IF_JSON: + break; }; cairo_destroy(im->cr); im->cr = cairo_create(im->surface); @@ -4007,6 +4028,10 @@ int rrd_graph( ** - options parsing now in rrd_graph_options() ** - script parsing now in rrd_graph_script() */ + +/* have no better idea where to put it - rrd.h does not work */ +int rrd_graph_xport(image_desc_t *); + rrd_info_t *rrd_graph_v( int argc, char **argv) @@ -4058,6 +4083,10 @@ rrd_info_t *rrd_graph_v( return NULL; } + if (im.imgformat >= IF_XML) { + rrd_graph_xport(&im); + } else { + /* Everything is now read and the actual work can start */ if (graph_paint(&im) == -1) { @@ -4065,7 +4094,7 @@ rrd_info_t *rrd_graph_v( im_free(&im); return NULL; } - + } /* The image is generated and needs to be output. ** Also, if needed, print a line with information about the image.