don't display legends for [HV]RULEs out of graph bounds (rrdgraph)
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sat, 8 Mar 2003 18:44:06 +0000 (18:44 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Sat, 8 Mar 2003 18:44:06 +0000 (18:44 +0000)
-- Christophe Kalt <kalt@taranis.org>

git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk/program@190 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_graph.c

index 451e891..715f0dc 100644 (file)
@@ -1358,6 +1358,16 @@ leg_place(image_desc_t *im)
 
     for(i=0;i<im->gdes_c;i++){
        fill_last = fill;
+        
+        /* 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';
 
        leg_cc = strlen(im->gdes[i].legend);