Getting Started with Gauge Component

Creating a Gauge Component

You can create a Gauge Component by creating an instance of the GaugeComponent.

$gauge = new GaugeComponent ();
$gauge->setDimensions (3, 2);

Configuring the gauge

A Gauge has two parameters which needs to be set.

  1. Limits : The minimum and maximum values of the gauge
  2. Value : The current value of the gauge

These two parameters can be configured by calling the setLimits function and the setValue function respectively.

Setting the limits

You can set the limits by calling the setLimits function which takes two parameters.

  • Minimum: The lower bound of the gauge range
  • Maximum : The upper bound of the gauge range
$gauge->setLimits(0, 120);

Setting the value

You can set the value by calling the setValue function. The setValue takes two parameters,

  1. Value : The value of the gauge in the range of min - max.

  2. Number Formatting : The number formatting properties.

$gauge->setValue(42, array(
    "numberPrefix" => "$"

Finally add the gauge to the dasboard by calling the addComponent function.


Complete Example


class SampleDashboard extends StandaloneDashboard { public function buildDashboard(){

$gauge = new GaugeComponent("gauge");
$gauge->setValue(144, array("numberPrefix" => '$'));
$gauge->setLimits(0, 200);


} }

$db = new SampleDashboard(); $db->renderStandalone();