[rrd-users] Fill color for unknown data

Rhett Hooper rhett.hooper at usurf.usu.edu
Wed Jul 2 23:27:10 MEST 2003


Hello list,

I have written a Perl script that uses rrdtool to graph weather station
data, (visible at http://gifts.sdl.usu.edu/blo/weather/) and I am having
some problems with a couple of the graphs.  (See
http://gifts.sdl.usu.edu/blo/weather/temperature-m.html#temp_1year)

We lost some data around the middle of last December, and our data only
goes back for a little under 3 years.  As you can see in the above
graphs, I have tried blacking out the unknown data so that it is obvious
that data is missing.  The problem is that when the values drop below
zero so that negative numbers show up on the y-axis, the blacked out
sections are exactly opposite of what I expected.

An example snippet of Perl that I use to create the 1 year Celsius
Temperature graph:

RRDs::graph "$path/blo-temp_c-1year.png",
    "--imgformat=PNG", "--interlaced",
    "--width=700", "--height=300",
    "--start=-31536000",
    "--title=Bear Lake Observatory - Temperature (Last 1 year)",
    "--vertical-label=Degrees Celsius",
    "DEF:avgtemp=$RRDFile:HourAvgAirTemp:AVERAGE",
    "CDEF:unknown=avgtemp,UN,INF,NEGINF,IF",
    "HRULE:0#0000FF",
    "LINE1:avgtemp#FF0000:Average\\l",
    "AREA:unknown#000000",
    "COMMENT:Date: $timestamp\\r";

Upon closer reading of the rrdgraph(1) man page, I see that AREA
"between 0 and the graph will be filled with the color specified"
instead of the area between the bottom of the graph and the graph being
filled.

I tried coming up with some CDEF, AREA, and SPAN statements that would
make it work the way I want, but haven't been successful.  One that
seems like it should work tried STACKing to INF on top of NEGINF:

rrdtool graph blo-temp_c-1year.png \
--imgformat=PNG --interlaced \
--width=700 --height=300 \
--start=-31536000 \
--title="Bear Lake Observatory - Temperature (Last 1 year)" \
--vertical-label="Degrees Celsius" \
DEF:avgtemp=rrd/blo.rrd:HourAvgAirTemp:AVERAGE \
CDEF:base=avgtemp,NEGINF,EXC,POP \
CDEF:unknown=avgtemp,UN,INF,NEGINF,IF \
HRULE:0#0000FF \
LINE1:avgtemp#FF0000:"Average\\l" \
AREA:base \
STACK:unknown#000000

If I put a color on the AREA:base, I can see it coloring below 0, but
the STACK doesn't create anything visible.  If I change the NEGINF in
the CDEF:base line to a negative number (like -20 which was the lowest
label on the y-axis before), then STACK works as expected and draws
black to the top of the graph.  The problem with this workaround is that
I don't know what the low y-axis value is that rrdtool would have
picked, and if I specify one, it could change the range of the y-axis.
I thought that NEGINF should be that value.

It would be nice if STACK was able to color between NEGINF and INF, or
if there was a FILL function that could be used to color the whole
vertical portion of a graph for unknown values.

Does anyone see something I'm missing, or have other workarounds to suggest?

Thanks.

PS. I created the RRD using using the following command:
rrdtool create blo.rrd --start 968400000 --step 3600 \
DS:HourAvgAirTemp:GAUGE:7200:-40:50 \
DS:HourMinAirTemp:GAUGE:7200:-40:50 \
DS:HourMaxAirTemp:GAUGE:7200:-40:50 \
DS:HourAvgAirTempRH:GAUGE:7200:-40:50 \
DS:HourMinAirTempRH:GAUGE:7200:-40:50 \
DS:HourMaxAirTempRH:GAUGE:7200:-40:50 \
DS:HourAvgRHumidity:GAUGE:7200:0:100 \
DS:HourMinRHumidity:GAUGE:7200:0:100 \
DS:HourMaxRHumidity:GAUGE:7200:0:100 \
DS:HourAvgWindSpeed:GAUGE:7200:0:100 \
DS:HourMaxWindSpeed:GAUGE:7200:0:100 \
DS:HourMeanWindDir:GAUGE:7200:0:360 \
DS:HourWindDirStdDev:GAUGE:7200:0:360 \
DS:HourAvgSolar:GAUGE:7200:0:10 \
DS:HourTotSolar:GAUGE:7200:0:10 \
DS:HourBatteryVoltage:GAUGE:7200:0:20 \
RRA:AVERAGE:0.5:1:43800 \
RRA:AVERAGE:0.5:24:7305

-- 
J. Rhett Hooper <rhett.hooper at sdl.usu.edu>
USU Research Foundation / Space Dynamics Laboratory
GPG Public Key 0x9049E3BC available at http://www.keyserver.net/

--
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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-users mailing list