[rrd-users] (right) alignement in 1.4.2

Tobias Oetiker tobi at oetiker.ch
Tue Jan 26 06:54:35 CET 2010


Hi Jean,

Today Jean-Yves Avenard wrote:

> Hi
>
> 2010/1/26 Tobias Oetiker <tobi at oetiker.ch>:
>
> >
> > 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!
>
> Brilliant!
>
> works perfectly.
> same graph, two different size
> http://htpc.avenard.org/power/?graph=1&view=day&date=24/01/2010&hour=23&minute=59
> http://htpc.avenard.org/power/?graph=1&view=day&date=24/01/2010&hour=23&minute=59&small=1
>
> While we are on new features ; one thing I would be really keen to see
> is the ability to have two different scales so you can plot on the
> same image two different graphs.
> One immediate application for me would be to show the impact of
> temperature to solar panel efficiency. Plotting temperature along side
> power output would be fantastic.
> So one the left side of the graph I would have the scale in kWh (or MJ
> to please some here) and on the other side I would have the scale in
> degres.
>
> I saw that this was added as a feature request on trac ; but if you
> ever found some free time :)
>
> Alternatively, I would be happy to look at the code and implement this
> myself ; if you could give me some pointers on which files I should
> look into

this is already done you can add a second axis ... you have to take
care of the scaling yourself using CDEF, but that is not much of a
problem ... check out the docs ...

see http://manuel.oetiker.ch/reslog/

(and http://manuel.oetiker.ch/reslog/graph.inc for the graph
instruction)

cheers
tobi
>
> Thanks once again
> Jean-Yves
>
>

-- 
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