From f678a16fdaf403793248984392d48c8a306cfa6a Mon Sep 17 00:00:00 2001 From: oetiker Date: Mon, 25 Jan 2010 22:25:14 +0000 Subject: [PATCH] add 'u' to backup one line for special legend placement tricks git-svn-id: svn://svn.oetiker.ch/rrdtool/trunk@2012 a5681a0c-68f1-0310-ab6d-d61299d08faa --- program/doc/rrdgraph_graph.pod | 11 +++++++++-- program/src/rrd_graph.c | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/program/doc/rrdgraph_graph.pod b/program/doc/rrdgraph_graph.pod index 44efce72..c740aad3 100644 --- a/program/doc/rrdgraph_graph.pod +++ b/program/doc/rrdgraph_graph.pod @@ -365,8 +365,15 @@ in connection with B<%s> to suppress empty unit strings. 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! diff --git a/program/src/rrd_graph.c b/program/src/rrd_graph.c index 24b58d08..a93fbb1c 100644 --- a/program/src/rrd_graph.c +++ b/program/src/rrd_graph.c @@ -1730,6 +1730,7 @@ int leg_place( 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 @@ int leg_place( 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; -- 2.30.2