RRDTool-OO

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

            $rrd->graph(
              image          => $image_file_name,
              vertical_label => 'Network Traffic',
              draw           => {
                file      => "file1.rrd",
                legend    => "First Source",
              },
              draw        => {
                file      => "file2.rrd",
                type      => 'area',
                stack     => 1,
                color     => '00FF00', # a green area stacked on top of the red one 
                dsname    => "load",
                legend    => "Second Source",
                cfunc     => 'AVERAGE'
              },
            );

        If a "file" parameter is specified per "draw", the defaults for
        "dsname" and "cfunc" are fetched from this file, not from the file
        that's attached to the "RRDTool::OO" object $rrd used.

        Graphs may also consist of algebraic calculations of previously
        defined graphs. In this case, graphs derived from real data sources
        need to be named, so that subsequent "cdef" definitions can refer to
        them and calculate new graphs, based on the previously defined
        graph:

            $rrd->graph(
              image          => $image_file_name,
              vertical_label => 'Network Traffic',
              draw           => {
                type      => 'line',
                color     => 'FF0000', # red line
                dsname    => 'load',
                name      => 'firstgraph',
                legend    => 'Unmodified Load',
              },
              draw        => {
                type      => 'line',
                color     => '00FF00', # green line
                cdef      => "firstgraph,2,*",
                legend    => 'Load Doubled Up',
              },
            );

        Note that the second "draw" doesn't refer to a datasource "dsname"
        (nor does it fall back to the default data source), but defines a
        "cdef", performing calculations on a previously defined draw named
        "firstgraph". The calculation is specified using RRDTool's reverse
        polish notation, where instructions are separated by commas
        ("firstgraph,2,*" simply multiplies "firstgraph"'s values by 2).

        On a global level, in addition to the "vertical_label" parameter
        shown in the examples above, "graph" offers a plethora of
        parameters:

        "vertical_label", "title", "start", "end", "x_grid", "y_grid",
        "alt_y_grid", "no_minor", "alt_y_mrtg", "alt_autoscale",
        "alt_autoscale_max", "base", "units_exponent", "units_length",
        "width", "height", "interlaced", "imginfo", "imgformat", "overlay",
        "unit", "lazy", "rigid", "lower_limit", "upper_limit",
        "logarithmic", "color", "no_legend", "only_graph",
        "force_rules_legend", "title", "step".

        Some options (e.g. "alt_y_grid") don't expect values, they need to
        be specified like

            alt_y_grid => undef

        in order to be passed properly to RRDTool.

        The "color" option expects a reference to a hash with various
        settings for the different graph areas: "back" (background),
        "canvas", "shadea" (left/top border), "shadeb" (right/bottom
        border), "grid", "mgrid" major grid, "font", "frame" and "arrow":

            $rrd->graph(
              ...
              color          => { back   => '#0e0e0e',
                                  arrow  => '#ff0000',
                                  canvas => '#eebbbb',
                                },
              ...
            );

        Fonts for various graph elements may be specified in "font" blocks,
        which must either name a TrueType font file or a PDF/Postscript font
        name. You may optionally specify a size and element name (defaults
        to DEFAULT, which to RRD means "use this font for everything).
        Example:

            font  => {
                name => "/usr/openwin/lib/X11/fonts/TrueType/GillSans.ttf",
                size => 16,
                element => "title"
            }

        Please check the RRDTool documentation for a detailed description on
        what each option is used for:

            http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/manual/rrdgraph.html

        Sometimes it's useful to print max, min or average values of a given
        graph at the bottom of the chart or to STDOUT. That's what "gprint"
        and "print" options are for. They are printing variables which are
        defined as "vdef"s somewhere else:

            $rrd->graph(
              image          => $image_file_name,
                  # Real graph
              draw           => {
                name      => "first_draw",
                dsname    => "load",
                cfunc     => 'MAX'
              },

                # vdef for calculating average of real graph
              draw           => {
                type      => "hidden",
                name      => "average_of_first_draw",



( run in 1.884 second using v1.01-cache-2.11-cpan-39bf76dae61 )