[rrd-users] Area in different colors

Simon Hobson linux at thehobsons.co.uk
Tue Dec 4 16:08:23 CET 2007


At 14:48 +0100 4/12/07, Simone Felici wrote:
>Hi to all!
>
>I know, this was often discussed, but I cannot find an example.
>I've a graph with one DS (area) and I need this single DS change 
>color every 20 units if the DS goes over these values. The scale 
>goes from 0 to 100
>(like a rainbow).


You mean something like :

         ggg         ggggg     g
       ooooooo     oooooooo   ooo
   rrrrrrrrrrrrr rrrrrrrrrrrrrrrrrrrr

where r=red, o=orange, g=green

How about something like this :

if y>20 then a=20, else a=y
if y>40 then b1=40, else b1=y
...
if y>80 then d1=80, else d1=y
if y>80 then e=y-d1 else e=0
d=d1-c1
c=c1-b1
b=b1-a
area ... a ...
area ... b ... stacked
...
area ... e ... stacked


Thus area a is from zero to y or 20 (whichever is lower), b is from 
the top of a to the lower of 40 or y, and so on.



More information about the rrd-users mailing list