allow --units-length to reserve label space even when --y-grid=none is in effect...
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 14 Feb 2007 06:53:01 +0000 (06:53 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 14 Feb 2007 06:53:01 +0000 (06:53 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1003 a5681a0c-68f1-0310-ab6d-d61299d08faa

doc/rrdgraph.pod
src/rrd_graph.c
src/rrd_graph.h

index b7bf370..59d3ac4 100644 (file)
@@ -191,6 +191,10 @@ placed every I<label factor> lines.  You can specify C<-y none> to
 suppress the grid and labels altogether.  The default for this option is
 to automatically select sensible values.
 
+If you have set --y-grid to 'none' not only the labels get supressed, also
+the space reserved for the labels is removed. You can still add space
+manually if you use the --units-length command to explicitly reserve space.
+
 [B<-Y>|B<--alt-y-grid>]
 
 Place the Y grid dynamically based on the graph's Y range. The algorithm
index 9be24e8..5a54c3d 100644 (file)
@@ -2424,7 +2424,7 @@ graph_size_location(image_desc_t *im, int elements
        if (im->draw_x_grid) {
            Yxlabel=im->text_prop[TEXT_PROP_AXIS].size *2.5;
        }
-       if (im->draw_y_grid) {
+       if (im->draw_y_grid || im->forceleftspace ) {
            Xylabel=gfx_get_text_width(im->canvas, 0,
                        im->text_prop[TEXT_PROP_AXIS].font,
                        im->text_prop[TEXT_PROP_AXIS].size,
@@ -3115,6 +3115,7 @@ rrd_graph_init(image_desc_t *im)
     im->maxval = DNAN;    
     im->unitsexponent= 9999;
     im->unitslength= 6; 
+    im->forceleftspace = 0;
     im->symbol = ' ';
     im->viewfactor = 1.0;
     im->extra_flags= 0;
@@ -3284,6 +3285,7 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
            break;
        case 'L':
            im->unitslength = atoi(optarg);
+            im->forceleftspace = 1;
            break;
        case 'T':
            im->tabwidth = atof(optarg);
index 6ed66d2..2e8e3bc 100644 (file)
@@ -191,11 +191,13 @@ typedef struct image_desc_t {
 #endif
     long           ximg,yimg;      /* total size of the image */
     double         magfact;        /* numerical magnitude*/
-    long         base;            /* 1000 or 1024 depending on what we graph */
+    long         base;             /* 1000 or 1024 depending on what we graph */
     char           symbol;         /* magnitude symbol for y-axis */
     float          viewfactor;     /* how should the numbers on the y-axis be scaled for viewing ? */
-    int            unitsexponent;    /* 10*exponent for units on y-asis */
+    int            unitsexponent;  /* 10*exponent for units on y-asis */
     int            unitslength;    /* width of the yaxis labels */
+    int            forceleftspace; /* do not kill the space to the left of the y-axis if there is no grid */
+
     int            extra_flags;    /* flags for boolean options */
     /* data elements */