Kamil
Kamil

Reputation: 13931

RRDtool and left horizontal scale formatting

Im learning RRDtool. I created a graph:

#!/bin/bash

rrdtool graph /home/pi/rrd/test.png \
    --end now --start now-6000s --width 500 --height 400 \
    DEF:ds0a=/home/pi/rrd/temperature.rrd:temperature:AVERAGE \
    AREA:ds0a#0000FF:"Temperature ('C)\l" \

It looks like this:

enter image description here

How can I format scale to add fractional part?

I want 25.2, 25.4, 25.6 etc. instead of 25 few times.

I have tried option from RRDtool documentation online

--left-axis-format

but my RRDtool has no such option.

There is no problem with

--right-axis-format

it works as I want, but... I want correct format on left side, not right.

Im using 1.4.7 on Raspberry Pi. I was asking on unix.stackexchange.com about this, but there are more questions about RRDtool here, so I moved my question here.

Upvotes: 1

Views: 5688

Answers (2)

Matthew Gleed
Matthew Gleed

Reputation: 1

I've installed rrdtool 1.4.8 on Raspbian using the testing branch. Unfortunately, the --left-axis-format option isn't available in 1.4.8 either. I could see in GIT where the code for --left-axis-format was added but my GIT foo isn't strong enough to figure out what version it was merged with.

Update: --left-axis-format wasn't added until 1.4.9 according to the changelog:

RRDtool 1.4.9 - 2014-09-29

New Features

  • allows rrdrestore to read input from stdin
  • add documentation for RRDs::xport
  • RPN operators MINNAN and MAXNAN
  • --left-axis-format option to rrd_graph

Updated update: I was able to easily compile rrdtool 1.4.9 from source just following the instructions in the included doc/rrdbuild.pod instruction file.

Upvotes: 0

Steve Shipway
Steve Shipway

Reputation: 4037

Later versions of RRDTool handle the axis labelling a bit better than earlier ones, so an upgrade might be all that is needed to fix it.

The first thing to try is --alt-y-grid option which changes the default way the Y-axis labels are placed. This might solve your issue.

You can override the automatic Y-axis calculations using something like --y-grid 0.2:5 which will put a tick every 0.2 but only label every 5 ticks, IE at 25, 26, 27 and so on. This will give you a sane but sparsely populated Y-axis.

However, maybe you want a label at every line, but including the decimals. In this case, you can specify the formatting of the Y-axis labels to include a decimal place: --left-axis-format "%.1lf" . You say that your version does not support this, so you might like to consider upgrading.

Upvotes: 1

Related Questions