[rrd-users] legend: getting everything aligned and perky

Simon Hobson linux at thehobsons.co.uk
Tue Jul 19 12:46:37 CEST 2011

Daniele Sluijters wrote:

>Probably a semi-dreaded topic here but does anyone have a good idea 
>as to how to make the legend align?

If you find out, can you let me know as well ;-)

At some point, (IIRC) I observed that an upgrade degraded this 
particular part - and graphs that used to have aligned legends no 
longer did.

What I've found is :
It helps to make all value fields the same width by means of the 
formatting string.
Tabs are supposed to help, but these are relative to the end of the 
previous element - so IMO not helpful.
Spaces seem to match other characters in strings, but NOT between 
strings and other elements (legend colour blobs, value fields).

So, for example, I've found that this generally works :

* "label      " ^^^^val ^^value
* "other label" ^^value ^^value

While these will all be misaligned :
* "label" ^^value
* "label  " ^^val

* "label" ^^value ^^value
* "label        " ^^value

* "label" ^^value
"   text" ^^value

Where * is the "colour blob", and ^ represents an implied space from 
the value format.
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

More information about the rrd-users mailing list