[rrd-developers] patch to do vertical gradients

Rian Shelley rians at cc.usu.edu
Thu Nov 5 19:08:39 CET 2009


Somebody on the irc channel suggested that I post this patch here. The
patch is against rrdtool 1.3.8.

This adds the GRAD element, which acts more or less like an AREA,
except you can specify a second color and a height which is used to
create a gradient from one color to the next.

I also attached an example graph that uses this patch. The gradients
in it are generated with these commands:

GRAD:ips#4444ff:half\\ firewall\\ states
GRAD:Bin#00cc00#0099441f:0:incoming\\ bandwidth

The syntax is
vname-or-value[#color[#color:gradientheight][:legend]][:STACK]

if the second color is missing, it is assumed to be #00000000 and the
gradientheight defaults to 50

gradientheight can actually produce 3 kinds of results depending on its value:
gradientheight > 0
    generates a fixed-height gradient from the data point down. (fire style)
gradientheight < 0
    generates a fixed-height gradient from the 0 line to the data
point. (fixed style)
gradientheight == 0
    generates a gradient that is stretched from the data point to the 0 line.
    this is what the example image is using.

I would appreciate any comments or suggestions.


--
rian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: grad.patch
Type: text/x-patch
Size: 16360 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20091105/d0c9371d/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: samplegradientgraph.png
Type: image/png
Size: 73705 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20091105/d0c9371d/attachment-0001.png 


More information about the rrd-developers mailing list