projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix alignment of centered items ... title and footer
[rrdtool.git]
/
src
/
rrd_graph.c
diff --git
a/src/rrd_graph.c
b/src/rrd_graph.c
index
d902a93
..
706bd49
100644
(file)
--- a/
src/rrd_graph.c
+++ b/
src/rrd_graph.c
@@
-1470,6
+1470,13
@@
time_t find_next_time(
localtime_r(¤t, &tm);
localtime_r(¤t, &tm);
+ int limit = 2;
+ switch (baseint) {
+ case TMT_SECOND: limit = 7200; break;
+ case TMT_MINUTE: limit = 120; break;
+ case TMT_HOUR: limit = 2; break;
+ default: limit = 2; break;
+ }
do {
switch (baseint) {
case TMT_SECOND:
do {
switch (baseint) {
case TMT_SECOND:
@@
-1500,7
+1507,7
@@
time_t find_next_time(
tm. tm_year += basestep;
}
madetime = mktime(&tm);
tm. tm_year += basestep;
}
madetime = mktime(&tm);
- } while (madetime == -1
); /* this is necessary to skip imp
ssible times
+ } while (madetime == -1
&& limit-- >= 0); /* this is necessary to skip impo
ssible times
like the daylight saving time skips */
return madetime;
like the daylight saving time skips */
return madetime;
@@
-1859,7
+1866,7
@@
int leg_place(
glue = 0;
}
if (prt_fctn == 'c')
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++) {
if (prt_fctn == 'r')
leg_x = legendwidth - fill + border;
for (ii = mark; ii <= i; ii++) {
@@
-2506,19
+2513,20
@@
void vertical_grid(
mgridtm,
im->xlab_user.
mgridst);
mgridtm,
im->xlab_user.
mgridst);
- ti < im->end;
+ ti < im->end
&& ti != -1
;
ti =
find_next_time(ti, im->xlab_user.gridtm, im->xlab_user.gridst)
) {
/* are we inside the graph ? */
if (ti < im->start || ti > im->end)
continue;
ti =
find_next_time(ti, im->xlab_user.gridtm, im->xlab_user.gridst)
) {
/* are we inside the graph ? */
if (ti < im->start || ti > im->end)
continue;
- while (timajor < ti) {
+ while (timajor < ti
&& timajor != -1
) {
timajor = find_next_time(timajor,
im->
xlab_user.
mgridtm, im->xlab_user.mgridst);
}
timajor = find_next_time(timajor,
im->
xlab_user.
mgridtm, im->xlab_user.mgridst);
}
+ if (timajor == -1) break; /* fail in case of problems with time increments */
if (ti == timajor)
continue; /* skip as falls on major grid line */
X0 = xtr(im, ti);
if (ti == timajor)
continue; /* skip as falls on major grid line */
X0 = xtr(im, ti);
@@
-2542,7
+2550,7
@@
void vertical_grid(
im->
xlab_user.
mgridst);
im->
xlab_user.
mgridst);
- ti < im->end;
+ ti < im->end
&& ti != -1
;
ti = find_next_time(ti, im->xlab_user.mgridtm, im->xlab_user.mgridst)
) {
/* are we inside the graph ? */
ti = find_next_time(ti, im->xlab_user.mgridtm, im->xlab_user.mgridst)
) {
/* are we inside the graph ? */
@@
-2568,9
+2576,9
@@
void vertical_grid(
labtm,
im->xlab_user.
labst);
labtm,
im->xlab_user.
labst);
- ti <=
+
(
ti <=
im->end -
im->end -
- im->xlab_user.precis / 2;
+ im->xlab_user.precis / 2
) && ti != -1
;
ti = find_next_time(ti, im->xlab_user.labtm, im->xlab_user.labst)
) {
tilab = ti + im->xlab_user.precis / 2; /* correct time for the label */
ti = find_next_time(ti, im->xlab_user.labtm, im->xlab_user.labst)
) {
tilab = ti + im->xlab_user.precis / 2; /* correct time for the label */
@@
-2960,7
+2968,7
@@
int graph_size_location(
}
else{
// we have no title; get a little clearing from the top
}
else{
// we have no title; get a little clearing from the top
- Ytitle =
1.5 *
Yspacing;
+ Ytitle = Yspacing;
}
if (elements) {
}
if (elements) {
@@
-3054,7
+3062,7
@@
int graph_size_location(
/* reserve space for padding below the graph */
if (im->extra_flags & NOLEGEND) {
/* reserve space for padding below the graph */
if (im->extra_flags & NOLEGEND) {
- Ymain -= Yspacing;
+ Ymain -=
0.5*
Yspacing;
}
if (im->watermark[0] != '\0') {
}
if (im->watermark[0] != '\0') {
@@
-3114,7
+3122,7
@@
int graph_size_location(
}
/* reserve space for padding below the graph */
if (im->extra_flags & NOLEGEND) {
}
/* reserve space for padding below the graph */
if (im->extra_flags & NOLEGEND) {
- im->yimg += Yspacing;
+ im->yimg +=
0.5*
Yspacing;
}
if (im->watermark[0] != '\0') {
}
if (im->watermark[0] != '\0') {
@@
-3143,7
+3151,7
@@
int graph_size_location(
*/
switch(im->legendposition){
case NORTH:
*/
switch(im->legendposition){
case NORTH:
- im->xOriginTitle =
Xvertical + Xylabel + (im->xsize
/ 2);
+ im->xOriginTitle =
(im->ximg
/ 2);
im->yOriginTitle = 0;
im->xOriginLegend = 0;
im->yOriginTitle = 0;
im->xOriginLegend = 0;
@@
-3164,7
+3172,7
@@
int graph_size_location(
break;
case WEST:
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;
im->yOriginTitle = 0;
im->xOriginLegend = 0;
@@
-3185,7
+3193,7
@@
int graph_size_location(
break;
case SOUTH:
break;
case SOUTH:
- im->xOriginTitle =
Xvertical + Xylabel + im->xsize
/ 2;
+ im->xOriginTitle =
im->ximg
/ 2;
im->yOriginTitle = 0;
im->xOriginLegend = 0;
im->yOriginTitle = 0;
im->xOriginLegend = 0;
@@
-3206,7
+3214,7
@@
int graph_size_location(
break;
case EAST:
break;
case EAST:
- im->xOriginTitle =
Xvertical + Xylabel +
im->xsize / 2;
+ im->xOriginTitle = im->xsize / 2;
im->yOriginTitle = 0;
im->xOriginLegend = Xvertical + Xylabel + Xmain + Xvertical2;
im->yOriginTitle = 0;
im->xOriginLegend = Xvertical + Xylabel + Xmain + Xvertical2;