[rrd-users] (right) alignement in 1.4.2

Tobias Oetiker tobi at oetiker.ch
Mon Jan 25 23:25:47 CET 2010


Friday Jean-Yves Avenard wrote:

> Hi
>
> 2010/1/22 Stefan M. Brandl <smb at r-kom.de>:
> > This is a right-aligned text with the grapg-generation date.
> > With rrdtool 1.3.9 it's correct aligned on the right side (see attachement).
> > With 1.4.2 the text is nor fully bounded to the right side.
> > Can I get the old behavior back?
>
> While we're on about right-aligned , it is possible to have on the
> same ligne part of the text that is left aligned, and another that is
> right aligned?
>

try this:

Index: src/rrd_graph.c
===================================================================
--- src/rrd_graph.c     (revision 2011)
+++ src/rrd_graph.c     (working copy)
@@ -1730,6 +1730,7 @@
                 prt_fctn != 'r' &&
                 prt_fctn != 'j' &&
                 prt_fctn != 'c' &&
+                prt_fctn != 'u' &&
                 prt_fctn != 's' && prt_fctn != '\0' && prt_fctn != 'g') {
                 free(legspace);
                 rrd_set_error
@@ -1839,6 +1840,8 @@
                     leg_y += im->text_prop[TEXT_PROP_LEGEND].size * 1.8;
                 if (prt_fctn == 's')
                     leg_y -= im->text_prop[TEXT_PROP_LEGEND].size;
+                if (prt_fctn == 'u')
+                    leg_y -= im->text_prop[TEXT_PROP_LEGEND].size *1.8;

                 if(calc_width && (fill > legendwidth)){
                     legendwidth = fill;
Index: doc/rrdgraph_graph.pod
===================================================================
--- doc/rrdgraph_graph.pod      (revision 1967)
+++ doc/rrdgraph_graph.pod      (working copy)
@@ -365,8 +365,15 @@
 A special case is COMMENT:B<\s> which inserts some additional vertical space
 before placing the next row of legends.

-If you are using the proportional font in your graph, you can use tab
-characters or the sequence B<\t> to line-up legend elements. Note that
+If you want to have left and right aligned legends on the same line use COMMENT:B<\u>
+to go one line back like this:
+
+ COMMENT:left\l
+ COMMENT:\u
+ COMMENT:right\r
+
+When using a proportional font in your graph, the tab
+characters or the sequence B<\t> will line-up legend elements. Note that
 the tabs inserted are relative to the start of the current legend
 element!



cheers
tobi
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch tobi at oetiker.ch ++41 62 775 9902 / sb: -9900



More information about the rrd-users mailing list