Code

* fore-rules-legend option -- author name missing
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Mon, 25 Oct 2004 22:22:53 +0000 (22:22 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Mon, 25 Oct 2004 22:22:53 +0000 (22:22 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@294 a5681a0c-68f1-0310-ab6d-d61299d08faa

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

index ae3f8a68bd962f0ee767735cba481babe676ac5a..df7a836a00498f03afabfeb9eec74ce62e36df56 100644 (file)
@@ -328,6 +328,10 @@ B<[-g|--no-legend]>
 
 Suppress generation of legend; only render the graph.
 
+B<[-F|--force-rules-legend]>
+
+Force the generation of HRULE and VRULE legend even if those HRULE or VRULE will not be drawn because out of graph boundaries (mimics behaviour of pre 1.0.42 versions).
+
 B<[-b|--base E<lt>valueE<gt>]>
 
 If you are graphing memory (and NOT network traffic) this switch
index d22c85350a2750d36455411afa08b74308975f6c..85984b3e46adcf0d63615256387636ea2d567a6a 100644 (file)
@@ -1396,13 +1396,15 @@ leg_place(image_desc_t *im)
         
         /* hid legends for rules which are not displayed */
         
-       if (im->gdes[i].gf == GF_HRULE &&
-           (im->gdes[i].yrule < im->minval || im->gdes[i].yrule > im->maxval))
-           im->gdes[i].legend[0] = '\0';
-
-       if (im->gdes[i].gf == GF_VRULE &&
-           (im->gdes[i].xrule < im->start || im->gdes[i].xrule > im->end))
-           im->gdes[i].legend[0] = '\0';
+       if(!(im->extra_flags & FORCE_RULES_LEGEND)) {
+               if (im->gdes[i].gf == GF_HRULE &&
+                   (im->gdes[i].yrule < im->minval || im->gdes[i].yrule > im->maxval))
+                   im->gdes[i].legend[0] = '\0';
+
+               if (im->gdes[i].gf == GF_VRULE &&
+                   (im->gdes[i].xrule < im->start || im->gdes[i].xrule > im->end))
+                   im->gdes[i].legend[0] = '\0';
+       }
 
        leg_cc = strlen(im->gdes[i].legend);
        
@@ -2799,6 +2801,7 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
            {"lazy",       no_argument,       0,  'z'},
             {"zoom",       required_argument, 0,  'm'},
            {"no-legend",  no_argument,       0,  'g'},
+           {"force-rules-legend",no_argument,0,  'F'},
             {"only-graph", no_argument,       0,  'j'},
            {"alt-y-grid", no_argument,       0,  'Y'},
             {"no-minor",   no_argument,       0,  'I'},
@@ -2813,7 +2816,7 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
 
 
        opt = getopt_long(argc, argv, 
-                         "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjYAMX:S:N",
+                        "s:e:x:y:v:w:h:iu:l:rb:oc:n:m:t:f:a:I:zgjFYAMX:S:N",
                          long_options, &option_index);
 
        if (opt == EOF)
@@ -2838,6 +2841,9 @@ rrd_graph_options(int argc, char *argv[],image_desc_t *im)
        case 'g':
            im->extra_flags |= NOLEGEND;
            break;
+       case 'F':
+           im->extra_flags |= FORCE_RULES_LEGEND;
+           break;
        case 'X':
            im->unitsexponent = atoi(optarg);
            break;
index 7cf2a6ea888d5615d1e393a2566ab633085c71a4..181474cbd217a41009e23920e003f3e32cd5f6cb 100644 (file)
@@ -14,6 +14,7 @@
 #define NOLEGEND       0x08    /* use no legend */
 #define NOMINOR         0x20    /* Turn off minor gridlines */
 #define ONLY_GRAPH      0x24   /* use only graph */
+#define FORCE_RULES_LEGEND     0x40    /* force printing of HRULE and VRULE legend */
 
 
 enum tmt_en {TMT_SECOND=0,TMT_MINUTE,TMT_HOUR,TMT_DAY,