[rrd-users] Minor Graph Rendering Issue
Tobias Oetiker
tobi at oetiker.ch
Fri Dec 16 18:41:37 CET 2011
Hi Chris,
Today Chris Mason wrote:
> Hi,
>
> > CDEF:ifInOctetsBitsN=0,ifInOctetsBits,-
>
> I had this originally and changed it to what I had to see if it made
> any difference.
>
> Please find attached a text file which has the offline commands
> required to recreate the problem.
> I have also attached the image it produces which shows the green area
> above the 0 line.
the grid fitting code needed some help ... here is the patch which
will be in the nex release:
Index: trunk/program/src/rrd_gfx.c
===================================================================
--- trunk/program/src/rrd_gfx.c (revision 2242)
+++ trunk/program/src/rrd_gfx.c (revision 2243)
@@ -329,10 +329,10 @@
line_width = cairo_get_line_width(cr);
line_height = line_width;
cairo_user_to_device_distance(cr, &line_width, &line_height);
- line_width = line_width / 2.0 - (long) (line_width / 2.0);
- line_height = line_height / 2.0 - (long) (line_height / 2.0);
- *x = (double) ((long) (*x + 0.5)) - line_width;
- *y = (double) ((long) (*y + 0.5)) + line_height;
+ line_width = line_width / 2.0 - ceil(line_width / 2.0);
+ line_height = line_height / 2.0 - ceil(line_height / 2.0);
+ *x = ceil(*x - 0.5) - line_width;
+ *y = ceil(*y + 0.5) + line_height;
cairo_device_to_user(cr, x, y);
}
@@ -348,7 +348,7 @@
if (!im->gridfit)
return;
cairo_user_to_device(cr, x, y);
- *x = (double) ((long) (*x + 0.5));
- *y = (double) ((long) (*y + 0.5));
+ *x = floor(*x);
+ *y = ceil(*y);
cairo_device_to_user(cr, x, y);
}
cheers
tobi
--
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900
More information about the rrd-users
mailing list