[rrd-users] q:how are decimal places calculated on Y-axis? (how toinfluence)?

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Sat Jun 20 11:35:39 CEST 2009


----- Original Message ----- 
From: "Pablo Sanchez" <pablo at blueoakdb.com>
To: <rrd-users at lists.oetiker.ch>
Sent: Friday, June 19, 2009 6:04 PM
Subject: [rrd-users] q:how are decimal places calculated on Y-axis? (how 
toinfluence)?


> Howdy,
>
> I have a barometric graph which can display results in hPA or inHG.  I
> store the data in hPA and use a CDEF to convert it to inHG when
> requested.
>
> My problem is that for the graph period, the `inHG' value may vary
> only slightly:
>
>     max:  29.97
>     min:  29.88
>
> I've tinkered with `--y-grid' to get better grid steps (before I was
> only getting one line at 30 and the resulting graphed line was very
> flat.  :):
>
>   --y-grid .01:5
>
> and the line graphs very well.  However, the y-axis labels seem to be
> rounded.  Here's an example of what I see versus what I'd like:
>
>    Wanted     Rendered
>    ------     --------
>    30.05         30
>    30.00         30
>    29.95         30
>    29.90         30
>    29.85         30
>    29.80         30
>
> I've tried using the `--alt-y-grid' option but that didn't help.
>
> I'm using a very old version of RRD on this weather-station laptop:
> 1.2.23
>
> Am I missing an obvious `rrdtool graph' switch or is this a bug in
> this very old version of RRD?  :)


I got intrigued by this question and I just knew I've seen this happen in 
the past. I found version 1.2.23 on my antique fedora machine and wrote this 
small script. Try it.

rrdtool create test.rrd --start 1245448800 DS:test:GAUGE:300:U:U 
RRA:AVERAGE:0:1:10

rrdtool update test.rrd 1245449100:29.97
rrdtool update test.rrd 1245449400:29.96
rrdtool update test.rrd 1245449700:29.95
rrdtool update test.rrd 1245450000:29.94
rrdtool update test.rrd 1245450300:29.95
rrdtool update test.rrd 1245450600:29.96
rrdtool update test.rrd 1245450900:29.97
rrdtool update test.rrd 1245451200:29.98
rrdtool update test.rrd 1245451500:29.99

set `rrdtool graph whatever DEF:test=test.rrd:test:AVERAGE 
PRINT:test:MIN:%6.2lf PRINT:test:MAX:%6.2lf`

rrdtool graph test.png --start 1245448800 --end 1245451500 \
        --title "min $2 max $3" \
        --lower-limit $2 \
        --upper-limit $3 \
        --rigid \
        --alt-y-grid \
        DEF:test=test.rrd:test:AVERAGE \
        LINE1:test#FF0000:test


Both alt-y-grid and rigid seem to be necessary, my initial suggestion of 
using -L was not.

If you don't need the scale to be 'dynamic', you can leave out that 1st 
rrdtool command and just use fixed numbers in the 2nd call.

HTH
Alex



More information about the rrd-users mailing list