[rrd-developers] Problems with MIN and graphing (Patch)

Tobias Oetiker oetiker at ee.ethz.ch
Mon Jan 24 22:23:16 MET 2000


Hi Mary,

Here is the patch which fixes the MIN problem ...

---------------
--- rrd_graph.c~        Fri Jan  7 09:43:39 2000
+++ rrd_graph.c Mon Jan 24 22:20:02 2000
@@ -559,12 +559,16 @@
         
     for (src_row = skiprows; src_row < row_cnt; src_row+=reduce_factor) {
        for (col=0;col<(*ds_cnt);col++){
-           double newval=0;
+           double newval=DNAN;
            unsigned long validval=0;
            for (i=0;i<reduce_factor && src_row+i<row_cnt;i++) {
                unsigned long ptr = (src_row+i)* (*ds_cnt)+col;
                if (isnan((*data)[ptr])) continue; /* we can't help with NAN
*/
                validval++;
+               if (isnan(newval)) {
+                   newval = (*data)[ptr];
+               } else {
+                  
                switch (cf) {
                case CF_AVERAGE:
                    newval += (*data)[ptr];
@@ -578,6 +582,7 @@
                case CF_LAST:
                    newval = (*data)[ptr];
                    break;
+                 }
                }
            }
            if (validval == 0){newval = DNAN;} else{
--------------------

use gnu patch to apply ...

cheers
tobi


-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, Timelord & SysMgr @ EE-Dept ETH-Zurich
 / // _ \/ _ \/ / TEL: +41(0)1-6325286  FAX:...1517  ICQ: 10419518 
/_/ \.__/_.__/_/ oetiker at ee.ethz.ch http://ee-staff.ethz.ch/~oetiker

--
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



More information about the rrd-developers mailing list