Matthew Chambers wrote: > Is there a way to tell rrdtool to generate a graph image (including the > legend) with exactly the dimensions provided to it on the command line? > I've done a hackish workaround which involves running rrdtool twice, so that > the extra width and height of the legend can be detected and then > compensated for, but that is quite suboptimal and not very scalable. > Otherwise, is there a way to get more control over how the legend is > formatted? My hackish workaround doesn't always work because if the legend > format changes (i.e. goes from one line to two lines) when the width is > adjusted, the adjustments are invalid.
I've had good luck with calculating the correct width and height to pass to rrdtool based on the the desired size of the finished image and the number of lines the legend is likely to take up. Basically, you can figure out the amount to take off the width pretty easily (I use 97 pixels). If your legend lines are a consistent length you can figure out the width at which they will wrap, then do something like: $w = $request['w'] - 97; $multiline = $request['w'] < 500; $dh = $multiline ? 169 : 141; $h = $request['h'] - $dh; HTH, Dan _______________________________________________ rrd-users mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
