> It would be nice if Dave Beaumont would post his scripts for generating > http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/gallery/beaumont-01.html > > As a matter of fact, It would be nice if the code were available for all > the gallery images. They would server as great examples.
Joao asked for some example graphs so here they are - http://www.ahouston.pwp.blueyonder.co.uk/ One thing I noticed was that using stacked CDEFs made for a very "blocky" graph - so what I've tried to do is increase the granularity by using say 200 CDEFs of 0.5 instead of stacking 100 with a value of 1. My perl code is truly awful, so I apologise in advance ;o) # granularity = the number of points per percent that we'll # graph to. i.e. value of 2 means that graphs will be rounded up to the # nearest half percent. my $granularity = 2; @ds_arg_rrd=("","-v","%","--title",$title,"--start",$start,"--end",$end, "-w",$width,"-h",$height,"-c","CANVAS#000000","-c","BACK#3399FF","-c","FONT# FFFFFF","--no-minor"); $ds_arg_rrd[0]="downstream.gif"; push @ds_arg_rrd,"DEF:ds=$rrd_file:$ds:AVERAGE"; push @ds_arg_rrd,"CDEF:dsutil=ds,$speed_ref->{ds},/,100,*"; # speed_ref is a pre-populated hash with the speed of the int foreach $f (0.. ($granularity*100) ) { $f_factor=$f / $granularity; push @ds_arg_rrd, "CDEF:ds_flame_$f=dsutil,$f_factor,GE,$granularity,/"; } push @ds_arg_rrd,"AREA:ds_flame_0$flame[0]"; foreach $f (0 .. ($granularity*100) ) { # @flame is an array of graduated colors, # 255 elements big. # we divide by 254 to ensure that we dont # index a value of out the arrays bounds. $f_factor=$f / ($granularity*100/254); push @ds_arg_rrd, "STACK:ds_flame_$f$flame[$f_factor]"; } ($averages,$w,$h)=RRDs::graph(@ds_arg_rrd); my $err=RRDs::error; print "ERROR while updating $rrd_file: $err\n" if $err; sub flame_colors() { # This sub creates the @flame array by incrementing red # while decrementing blue. Green stays constant foreach $i (0..255) { $r = $i; $b = 255 - $i; $g = '00'; if ($r<=15) {$r_hex='0';} else {$r_hex='';} if ($b<=15) {$b_hex='0';} else {$b_hex='';} $r_hex.=sprintf("%x",$r); $b_hex.=sprintf("%x",$b); $g_hex =$g; $color="#$r_hex$g_hex$b_hex"; push @flame,$color; } } Cheers, Allan Houston -- Unsubscribe mailto:[EMAIL PROTECTED] Help mailto:[EMAIL PROTECTED] Archive http://www.ee.ethz.ch/~slist/rrd-users WebAdmin http://www.ee.ethz.ch/~slist/lsg2.cgi
