rrdFlotMatrix module


The rrdFlotMatrix Javascript module implements a class used to represents a DS from a list of similar RDD archives as a Flot plot.

All RRDs must have the same step, the same DS names and the same number of RRAs.


Overview

This module provide a single class: rrdFlotMatrix.

Given a RRDFile object, this class creates an interactive Flot plot.

In order to use this module, you also need to include:

Class rrdFlotMatrix

The rrdFlotMatrix constructor has two to six arguments:

Argument

Description

html_id

ID of a HTML element, possibly a DIV.

rrd_files

A list of RRDs. Each element of the list contains a [rrd_id,rrd_file] pair.

  • rrd_id - Logical name for the RRD.
  • rrd_file -An object of type RRDFile or equivalent.

ds_list (optional)

A list of DSes. Each element of the list contains a [ds_id,ds_title] pair.

  • ds_id - Logical name for the DS (as accepted by RRDFile.getDS()).
  • ds_title - Name to display to the user.

If undefined, all the DS's of the RRD will be used.

graph_options (optional)

Global graphing options. See Flot documentation for more details.

The recognized elements and the default values are:

  graph_options = {
    legend: {position:"nw",noColumns:3},
    lines: { show:true },
    yaxis: { autoscaleMargin: 0.20},
    tooltip: true,
    tooltipOpts: { content: "<h4>%s</h4> Value: %y.3" }, // %s: series text, %y.3: y-value toPrecision(3)
  };

rrd_graph_options (optional)

Dictionary of graphing options. This must be a dictionary of rrd_id. Each element of the dictionary contains graphing options. See Flot documentation for more details.

The recognized elements and the default values are:

   {
     title: label  or rrd_name                          // this is what is displayed in the checkboxes
     checked: true                                      // boolean
     label: title or rrd_name                           // this is what is displayed in the legend
     color: rrd_index                                   // see Flot docs for details
     lines: { show:true, fill: true, fillColor:color }  // see Flot docs for details
   }

rrdflot_defaults (optional)

Dictionary of rrd_flot options. All are optional.

The recognized elements and the default values are:

 {
    graph_only: false        // If true, limit the display to the graph only
    legend: "Top"            //Starting location of legend. Options are: 
                             //   "Top","Bottom","TopRight","BottomRight","None".
    num_cb_rows: 12          //How many rows of DS checkboxes per column.
    use_element_buttons: false  //To be used in conjunction with num_cb_rows: This option
                             //    creates a button above every column, which selects
                             //    every element in the column. 
    multi_rra: false         //"true" appends the name of the RRA consolidation function (CF) 
                             //    (AVERAGE, MIN, MAX or LAST) to the name of the RRA. Useful 
                             //    for RRAs over the same interval with different CFs.  
    use_checked_RRDs: false   //Use the list checked_RRDs below.
    checked_RRDs: []          //List of elements to be checked by default when graph is loaded. 
                             //    Overwrites graph options. 
    use_rra: false           //Whether to use the rra index specified below.
    rra: 0                   //RRA (rra index in rrd) to be selected when graph is loaded. 
    use_windows: false       //Whether to use the window zoom specifications below.
    window_min: 0            //Sets minimum for window zoom. X-axis usually in unix time. 
    window_max: 0            //Sets maximum for window zoom.
    graph_height: "300px"    //Height of main graph. 
    graph_width: "500px"     //Width of main graph.
    scale_height: "110px"    //Height of small scaler graph.
    scale_width: "250px"     //Width of small scaler graph.
 } 

Once instatiated, the object will automatically draw the plot and handle user interaction.


This module is part of the javascriptRRD package hosted at http://javascriptrrd.sourceforge.net.
It is licensed under the MIT license.