From b13e83720c268c2624b9bd7a8e09a0355366c0cc Mon Sep 17 00:00:00 2001 From: oetiker Date: Mon, 25 Oct 2004 22:22:53 +0000 Subject: [PATCH] * fore-rules-legend option -- author name missing git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@294 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/rrdgraph.src | 4 ++++ src/rrd_graph.c | 22 ++++++++++++++-------- src/rrd_graph.h | 1 + 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/doc/rrdgraph.src b/doc/rrdgraph.src index ae3f8a6..df7a836 100644 --- a/doc/rrdgraph.src +++ b/doc/rrdgraph.src @@ -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 EvalueE]> If you are graphing memory (and NOT network traffic) this switch diff --git a/src/rrd_graph.c b/src/rrd_graph.c index d22c853..85984b3 100644 --- a/src/rrd_graph.c +++ b/src/rrd_graph.c @@ -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; diff --git a/src/rrd_graph.h b/src/rrd_graph.h index 7cf2a6e..181474c 100644 --- a/src/rrd_graph.h +++ b/src/rrd_graph.h @@ -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, -- 2.11.0