PPF Graph Widget

Configure line and bar graphs in PPF report definitions.

Full Example

Below is an example of all available options when defining a graph. Only options marked as required must be defined — all others use sensible defaults.

var ppf_widgets = {
    example_graph: {
        ele: ['graph1', 'graph2'],
        data: 'speeddata',
        type: 1,
        datadepend: ['voip', 'act'],
        gui: {
            width: '100%',
            height: 500,
            margin: { top: 30, bottom: 120, left: 60, right: 10 },
            mBg: ['#ffffff'],
            mBgDir: 'vertical',
            gBg: '#f9f9f9',
            axlCol: '#000000',
            axLw: 1,
            xTitle: 'X Title',
            xFsz: 10,
            xFnt: 'Arial',
            yTitle: 'Y Title',
            yFsz: 10,
            yFnt: 'Arial',
            title: 'Default Title',
            titFsz: 10,
            titFnt: 'Arial',
            labelFnt: 'Arial',
            labelSize: 8,
            lblCol: '#000000',
            plotLineWidth: 1,
            plotDots: false,
            dotSize: 2,
            dotCol: '#000000',
            dotBorder: '#FF0000',
            dotBrdSize: 0,
            yrTitle: "Right Axis",
            yrScale: false,
            xLbls: true
        },
        metrics: ['speed.dspeed', 'speed.uspeed'],
        metricsn: ['Download', 'Upload'],
        metricsc: ['#FF0000', '#000000'],
        doplot: [true, true],
        legend: true,
        metricpas: ['line', 'bar'],
        url: '',
        depend: [[]]
    }
}

Required Keys

KeyDescription
ele Required. HTML element IDs where the graph should render. For example, if the HTML contains <div id='speedgraph'></div>, use: ele: ['speedgraph']
data Required. The data set name to use for the graph. For example: data: 'speeddata'
type Required. Must be 1 for a graph widget.
datadepend If the widget depends on a certain data type, define it as an array. Common types: voip, act (Quality), route, capacity.
metrics Required. Metrics to plot, in testtype.metric format. Metrics must be available for the chosen data set. See available metrics. Example: metrics: ['speed.dspeed', 'speed.uspeed']
metricsn Required. Friendly names for the legend, one per metric. Example: metricsn: ['Download', 'Upload']
metricsc Required. Colors for each plot line, one per metric. Example: metricsc: ['#ff0000', '#000000']
doplot Required. Whether each metric is plotted on the graph. Metrics set to false still appear in the mouseover popup. Example: doplot: [true, true]
metricpas Required. Plot type for each metric: line or bar. Example: metricpas: ['line', 'bar']

GUI Options

All gui options are optional and use sensible defaults if not specified.

Dimensions & Margins

KeyDescriptionExample
widthWidth as pixels or percentage.'100%' or 500
heightHeight as pixels or percentage.500
margin.topHeader area height (contains the title). Pixels.30
margin.bottomFooter area height (contains X-axis labels and title). Pixels.120
margin.leftLeft margin (contains Y-axis labels and title). Pixels.60
margin.rightRight margin. Pixels.10

Colors & Backgrounds

KeyDescriptionExample
mBgBackground color(s) of the graph surround (not the plot area). Multiple values create a gradient.['#FFFFFF'] or ['#FFFFFF','#333333']
mBgDirGradient direction when multiple mBg colors are used.'vertical' or 'horizontal'
gBgBackground color of the plot area. Solid colors only.'#f9f9f9'
axlColAxis line color.'#000000'
axLwAxis line width in pixels.1
lblColFont color for axis labels.'#000000'

Titles & Fonts

KeyDescriptionExample
titleGraph title (appears in header area).'Download Speed'
titFszFont size for the graph title.14
titFntFont family for the graph title.'Arial'
xTitleX-axis title.'Date/Time'
xFszFont size for the X-axis title.10
xFntFont family for the X-axis title.'Arial'
yTitleY-axis title.'Bandwidth (Mbps)'
yFszFont size for the Y-axis title.10
yFntFont family for the Y-axis title.'Arial'
labelFntFont family for axis labels.'Arial'
labelSizeFont size for axis labels. Y-axis labels auto-shrink if they don't fit the margin.8
yrTitleRight-hand Y-axis title.'Right Scale'
yrScaleEnable/disable the right-hand Y-axis. When enabled, applies to the second metric.false
xLblsShow or hide X-axis labels.true

Plot Lines & Dots

KeyDescriptionExample
plotLineWidthWidth of plot lines in pixels.1
plotDotsShow circular dots at data points.false
dotSizeSize of dots (when enabled).2
dotColColor of dots.'#000000'
dotBorderColor of dot borders.'#FF0000'
dotBrdSizeBorder size in pixels. Set to 0 for no border.0

Other Options

KeyDescription
legendShow or hide the legend. Default: true. Mouseover labels remain functional when hidden.
urlWhen defined, makes the graph clickable — opens the URL in the same window. Example: url: 'https://www.visualware.com'
dependWidget dependencies. See dependency information.