oetiker / rrdtool-1.x

RRDtool 1.x - Round Robin Database
http://www.rrdtool.org
GNU General Public License v2.0
1.01k stars 263 forks source link

rrdgraph: full-size-mode for one direction only #717

Open rinigus opened 8 years ago

rinigus commented 8 years ago

It would be helpful to have an option where I could specify that the given graph width is in full size mode and that the height corresponds to canvas. At present, the size is given either for canvas or full size of a image, its impossible to mix the settings

Rationale: I am developing GUI for collectd (systemdatascope, https://github.com/rinigus/systemdatascope ) that shows collectd datasets in a desktop or Sailfish OS application using QML/Qt. This application uses rrdtool to generate the required images. While the width of the image is given by the size of the window (Linux desktop) or mobile device (Sailfish) and has to be specified by application, the height is given by user as a size of a canvas. This allows to have a column of consistent graphs one after another. Unfortunately, height of a full image depends on a legend and the application has to determine a map between image type (CPU overview, load, ...) and the total size of an image for a given canvas. At present, I am doing a 'dummy' image with specified canvas size first, recording the height, and later using RRDtool to generate images in full-size mode. While this approach works, it requires generation of extra images at the startup and there are some corner cases where this approach fails (when legend starts to get to the next line, for example).

Having an option that would allow to mix the size settings would resolve these issues.

PS: thank you for your great work!

oetiker commented 8 years ago

patches are welcome ...

rinigus commented 8 years ago

fair enough - I'll take a look into it a bit later.