# [rrd-users] Re: graphing problem

Alex van den Bogaerdt alex at ergens.op.het.net
Tue Oct 8 16:02:37 MEST 2002

```On Tue, Oct 08, 2002 at 03:33:53PM +0200, John Goor wrote:

[snip: having CDEF producing percentage]
>
> I want a line graph from 0 to 100 percent, with a green line from 0% till
> 80%, yellow from 80% till 95% and red for 95% up to 100%.

There's more than one way to do this.  Simple approach:

Define three CDEFs, for instance R,Y and G.  R is your current CDEF.
Y is the same as R however with a MAXimum of 95; G has a maximum of
80%

Now plot, in this order, an AREA for R,Y and G.

The CDEF for Y could be:

CDEF:Y=R,95,GT,95,R,IF

This is: if (R>95) return 95 else return R

A slightly better way would be to use CDEF and STACK, this means
calculating the appropriate values for Y and R (which should be
NaN in case the percentage isn't high enough).  STACK Y on top
of AREA G and STACK R on top of STACK Y.  This has a disadvantage
of the legend being in the wrong order would you decide to use
a legend.

HTH
Alex

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