summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c1d82d6)
raw | patch | inline | side by side (parent: c1d82d6)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 26 May 2008 07:45:19 +0000 (07:45 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Mon, 26 May 2008 07:45:19 +0000 (07:45 +0000) |
* space horizontal grid lines and lables a bit further apart for tight
layouts.
* let horizontal lines and y axis labels run a little closer for classic grid
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1378 a5681a0c-68f1-0310-ab6d-d61299d08faa
layouts.
* let horizontal lines and y axis labels run a little closer for classic grid
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@1378 a5681a0c-68f1-0310-ab6d-d61299d08faa
program/src/rrd_graph.c | patch | blob | history |
index 1849afecce4cf3fed14a49a5fde057b45da9248d..0cc78d4ca4f043baa21576a4007c1a386d863f72 100644 (file)
--- a/program/src/rrd_graph.c
+++ b/program/src/rrd_graph.c
/* the xaxis labels are determined from the number of seconds per pixel
in the requested graph */
-
-
int calc_horizontal_grid(
image_desc_t
*im)
if (im->ygrid_scale.gridstep == 0) /* range is one -> 0.1 is reasonable scale */
im->ygrid_scale.gridstep = 0.1;
/* should have at least 5 lines but no more then 15 */
- if (range / im->ygrid_scale.gridstep < 5)
+ if (range / im->ygrid_scale.gridstep < 5 && im->ygrid_scale.gridstep >= 30 )
im->ygrid_scale.gridstep /= 10;
if (range / im->ygrid_scale.gridstep > 15)
im->ygrid_scale.gridstep *= 10;
- if (range / im->ygrid_scale.gridstep > 5) {
+ if (range / im->ygrid_scale.gridstep > 5 ) {
im->ygrid_scale.labfact = 1;
- if (range / im->ygrid_scale.gridstep > 8)
+ if (range / im->ygrid_scale.gridstep > 8 || im->ygrid_scale.gridstep < 1.8 * im->text_prop[TEXT_PROP_AXIS].size )
im->ygrid_scale.labfact = 2;
} else {
im->ygrid_scale.gridstep /= 5;
sprintf(im->ygrid_scale.labfmt,
"%%%d.0f%s", len, (im->symbol != ' ' ? " %c" : ""));
}
- } else {
+ } else { /* classic rrd grid */
for (i = 0; ylab[i].grid > 0; i++) {
pixel = im->ysize / (scaledrange / ylab[i].grid);
gridind = i;
- if (pixel > 7)
+ if (pixel >= 5)
break;
}
for (i = 0; i < 4; i++) {
if (pixel * ylab[gridind].lfac[i] >=
- 2.5 * im->text_prop[TEXT_PROP_AXIS].size) {
+ 1.8 * im->text_prop[TEXT_PROP_AXIS].size) {
im->ygrid_scale.labfact = ylab[gridind].lfac[i];
break;
}