Full Example
Below is an example of all available options when defining a text widget. Only options marked as required must be defined.
var ppf_widgets = {
example_text: {
ele: ['txt1', 'txt2'],
data: 'speeddata',
type: 4,
datadepend: ['voip', 'act'],
text: '<p>Custom text here</p>',
depend: [
['endofmonth', 'tuesday'],
['endofweek', 'wednesday']
]
}
}
Defining a Text Widget
| Key | Description |
|---|---|
ele |
Required. HTML element IDs where the text should render. For example, if the HTML contains <div id='txt1'></div>, use: ele: ['txt1'] |
data |
Required. The data set name to use. Example: data: 'speeddata' |
type |
Required. Must be 4 for a text widget. |
datadepend |
If the widget depends on a certain data type, define it as an array. Common types: voip, act (Quality), route, capacity. |
text |
The text content — from a single word to multiple paragraphs. HTML markup is accepted. Example: For more complex usage see: data metrics, PPF variables, and PPF expressions in text widgets below. |
depend |
Widget dependencies. See dependency information. |
Text Widget Examples
Using Data Metrics
Using data in text widgets is a useful way to add more value to a report. Metrics can be defined in two ways.
The first is $$testtype.testmetric$$. For example, $$speed.dspeed$$ returns the average download speed result for the data set defined by the text widget:
text: '<p>The download speed result is $$speed.dspeed$$</p>'
The second is $$dataname.testtype.testmetric$$. For example, $$speeddata.speed.dspeed$$ returns the result from a specifically named data set, allowing text widgets to include metrics from multiple data sets:
text: '<p>The download speed result is $$speeddata.speed.dspeed$$</p>'
Using PPF Variables
PPF variables are useful when the same text will appear in multiple sections of a report. The format is $$repvars.varname$$.
The example below searches the defined report variables for the name companycopyright and prints its value:
text: '<p>Copyright $$repvars.companycopyright$$</p>'
Using PPF Expressions
PPF expressions allow text to change based on metrics or other report-specific criteria. Expressions are JavaScript functions. The format is $$exp.expname(parameters)$$.
text: '<p>The overall result of this test was $$exp.speedexp(||speed.dspeed||,||speed.uspeed||,"custom text")$$</p>'
In the example above, an expression named speedexp takes three parameters. The first two are metrics, the third is custom text.
Note: When defining metrics within an expression, use ||metric|| syntax instead of $$metric$$ which is used elsewhere.
For a more detailed example, see the page on PPF expressions.

