X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_graph.c;h=3f8ee1bff143af2dc004eb0e83ffaac4200b8e9f;hp=fa8f0f41a451e37936fe73e5c13d98be42bc25ad;hb=0993ad690db2a221cfbcb9b908dc80d950a802f9;hpb=13d7a72e157462f61aa90d3352479c0b4180e069 diff --git a/src/rrd_graph.c b/src/rrd_graph.c index fa8f0f4..3f8ee1b 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -59,6 +59,8 @@ text_prop_t text_prop[] = { {5.5, RRD_DEFAULT_FONT,NULL} /* watermark */ }; +char week_fmt[128] = "Week %V"; + xlab_t xlab[] = { {0, 0, TMT_SECOND, 30, TMT_MINUTE, 5, TMT_MINUTE, 5, 0, "%H:%M"} , @@ -87,10 +89,10 @@ xlab_t xlab[] = { , {2400, 0, TMT_HOUR, 12, TMT_DAY, 1, TMT_DAY, 2, 24 * 3600, "%a"} , - {3600, 0, TMT_DAY, 1, TMT_WEEK, 1, TMT_WEEK, 1, 7 * 24 * 3600, "Week %V"} + {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 %V"} + week_fmt} , {6 * 3600, 0, TMT_MONTH, 1, TMT_MONTH, 1, TMT_MONTH, 1, 30 * 24 * 3600, "%b"} @@ -894,11 +896,15 @@ int data_fetch( &im->gdes[i].ds_cnt, &im->gdes[i].ds_namv, &im->gdes[i].data)) == -1) { - return -1; - } + return -1; + } } im->gdes[i].data_first = 1; + /* must reduce to at least im->step + otherwhise we end up with more data than we can handle in the + chart and visibility of data will be random */ + im->gdes[i].step = max(im->gdes[i].step,im->step); if (ft_step < im->gdes[i].step) { reduce_data(im->gdes[i].cf_reduce, ft_step, @@ -1866,7 +1872,7 @@ int leg_place( glue = 0; } if (prt_fctn == 'c') - leg_x = (double)(legendwidth - fill) / 2.0; + leg_x = border + (double)(legendwidth - fill) / 2.0; if (prt_fctn == 'r') leg_x = legendwidth - fill + border; for (ii = mark; ii <= i; ii++) { @@ -3151,7 +3157,7 @@ int graph_size_location( */ switch(im->legendposition){ case NORTH: - im->xOriginTitle = Xvertical + Xylabel + (im->xsize / 2); + im->xOriginTitle = (im->ximg / 2); im->yOriginTitle = 0; im->xOriginLegend = 0; @@ -3172,7 +3178,7 @@ int graph_size_location( break; case WEST: - im->xOriginTitle = im->legendwidth + Xvertical + Xylabel + im->xsize / 2; + im->xOriginTitle = im->legendwidth + im->xsize / 2; im->yOriginTitle = 0; im->xOriginLegend = 0; @@ -3193,7 +3199,7 @@ int graph_size_location( break; case SOUTH: - im->xOriginTitle = Xvertical + Xylabel + im->xsize / 2; + im->xOriginTitle = im->ximg / 2; im->yOriginTitle = 0; im->xOriginLegend = 0; @@ -3214,7 +3220,7 @@ int graph_size_location( break; case EAST: - im->xOriginTitle = Xvertical + Xylabel + im->xsize / 2; + im->xOriginTitle = im->xsize / 2; im->yOriginTitle = 0; im->xOriginLegend = Xvertical + Xylabel + Xmain + Xvertical2; @@ -4301,6 +4307,7 @@ void rrd_graph_options( { "border", required_argument, 0, 1007}, { "grid-dash", required_argument, 0, 1008}, { "dynamic-labels", no_argument, 0, 1009}, + { "week-fmt", required_argument, 0, 1010}, { 0, 0, 0, 0} }; /* *INDENT-ON* */ @@ -4486,6 +4493,10 @@ void rrd_graph_options( case 1009: /* enable dynamic labels */ im->dynamic_labels = 1; break; + case 1010: + strncpy(week_fmt,optarg,sizeof week_fmt); + week_fmt[(sizeof week_fmt)-1]='\0'; + break; case 1002: /* right y axis */ if(sscanf(optarg,