[rrd-developers] Autoscaling logarithmic

Beat Zahnd beat.zahnd at phim.unibe.ch
Mon Jan 13 15:17:34 MET 2003


Hello

Is there some reason for the fixed lower bound with logarithmic scaling?

This patch enables autoscaling:


diff -ru tmp/rrdtool-1.0.40/src/rrd_graph.c rrdtool-1.0.40/src/rrd_graph.c
--- tmp/rrdtool-1.0.40/src/rrd_graph.c  Fri Oct 11 20:39:47 2002
+++ rrdtool-1.0.40/src/rrd_graph.c      Mon Jan 13 15:08:22 2003
@@ -1340,17 +1327,22 @@

      if (isnan(minval)) minval = 0.0;
      if (isnan(maxval)) maxval = 1.0;
-
+
      /* adjust min and max values */
+    /* don't adjust low-end with log scale */ /* why not? */
      if (isnan(im->minval)
-       || ((!im->logarithmic && !im->rigid) /* don't adjust low-end 
with log scale */
-           && im->minval > minval))
-       im->minval = minval;
+       || ((!im->rigid)
+           && im->minval > minval)){
+        if (im->logarithmic)
+               im->minval = minval * 0.5;
+       else
+               im->minval = minval;
+    }
      if (isnan(im->maxval)
         || (!im->rigid
             && im->maxval < maxval)){
         if (im->logarithmic)
-           im->maxval = maxval * 1.1;
+           im->maxval = maxval * 2.0;
         else
             im->maxval = maxval;
      }
@@ -3006,8 +3031,10 @@
             break;
         case 'o':
             im.logarithmic = 1;
+/*
             if (isnan(im.minval))
                 im.minval=1;
+*/
             break;
         case 'c':
             if(sscanf(optarg,
@@ -3054,7 +3081,7 @@
         return -1;
      }

-    if (im.logarithmic == 1 && (im.minval <= 0 || isnan(im.minval))){
+    if (im.logarithmic == 1 && (im.minval <= 0)){
         rrd_set_error("for a logarithmic yaxis you must specify a 
lower-limit > 0");
         return -1;
      }


Regards,
Beat


-- 
Beat ZAHND
Physics Institute
University of Bern                   phone  +41 31 631 3466
Sidlerstrasse 5                      fax    +41 31 631 4405
CH-3012 Bern (Switzerland)  mailto:beat.zahnd at phim.unibe.ch

        http://www.phim.unibe.ch/rosina/rosina.html
                 http://rosetta.esa.int/

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-developers mailing list