1

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.

Kamil
  • 13,363
  • 24
  • 88
  • 183

2 Answers2

1

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.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • With --alt-y-grid numbers responsible for 25.2 etc. just disappear. There is no 1.4.8 version for raspberry, I can't compile new one because there is no cairo_png cairo_pdf and few other librariers for arm/raspberry... :( I don't want to compile 50 things to handle formatting... – Kamil Jul 31 '14 at 15:37
  • I think the left-axis-format option was added in the later version to address precisely this problem - since it uses 0dp if the y-axis number is >1, which causes the problem you see. If you can't recompile the latest version, then I'd suggest using --y-grid to at least hide the duplicated labels. I don't think there is any way to achieve exactly what you want with your version of rrdtool. – Steve Shipway Aug 02 '14 at 08:54
  • I have tried to compile 1.4.8 (current version), but I have so many warnings and errors from ./configure script, that I gave up. I will use pChart or something else for charting. RRD graph functionality is not that versatile I expected. – Kamil Aug 02 '14 at 09:31
0

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.