From 1bdc6ae9270bf77bc983ef661142c89e12464466 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Wed, 30 May 2007 12:34:09 +0000 Subject: draw smoke properly even when there is a lot of loss --- lib/Smokeping.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/Smokeping.pm') diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index 6676a40..36e97d6 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -697,13 +697,13 @@ sub smokecol ($) { return [] unless $count > 2; my $half = $count/2; my @items; - for (my $i=$count; $i > $half; $i--){ - my $color = int(190/$half * ($i-$half))+50; - push @items, "AREA:cp".($i)."#".(sprintf("%02x",$color) x 3); - }; - for (my $i=int($half); $i > 0; $i--){ - my $color = int(190/$half * ($half - $i + 1))+64; - push @items, "AREA:cp".($i)."#".(sprintf("%02x",$color) x 3); + my $itop=$count; + my $ibot=1; + for (; $itop > $ibot; $itop--,$ibot++){ + my $color = int(190/$half * ($half-$ibot))+50; + push @items, "CDEF:smoke${ibot}=cp${ibot},UN,UNKN,cp${itop},cp${ibot},-,IF"; + push @items, "AREA:cp${ibot}"; + push @items, "STACK:smoke${ibot}#".(sprintf("%02x",$color) x 3); }; return \@items; } @@ -1006,7 +1006,7 @@ sub get_detail ($$$$;$){ '--color', 'BACK#ffffff', '--color', 'CANVAS#ffffff', (map {"DEF:ping${_}=${rrd}:ping${_}:AVERAGE"} 1..$pings), - (map {"CDEF:cp${_}=ping${_},$max->{$start},MIN"} 1..$pings), + (map {"CDEF:cp${_}=ping${_},0,$max->{$start},LIMIT"} 1..$pings), ("DEF:loss=${rrd}:loss:AVERAGE"), @upargs,# draw the uptime bg color @lossargs, # draw the loss bg color -- cgit v1.2.3-24-g4f1b