From f54455954eb3111c1b702d3ed7b9daff833690f3 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/program@2012 a5681a0c-68f1-0310-ab6d-d61299d08faa --- doc/rrdgraph_graph.pod | 11 +++++++++-- src/rrd_graph.c | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/doc/rrdgraph_graph.pod b/doc/rrdgraph_graph.pod index 44efce7..c740aad 100644 --- a/doc/rrdgraph_graph.pod +++ b/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/src/rrd_graph.c b/src/rrd_graph.c index 24b58d0..a93fbb1 100644 --- a/src/rrd_graph.c +++ b/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