Customizing KPI Display value

Formatting the number

You can format the number displayed in the KPI by passing an option to the setValue function like this:

$kpi->setValue (19136, array(
    "numberPrefix" => "$"
));

All the standard number formatting features are available. For a full list of available parameters and examples with their usage, see "Number formatting in razorflow"

Changing the color of the text

You can change the value color of the KPI that is displayed by setting the valueTextColor parameter

$kpi->setValue (42, array(
    "valueTextColor" => "#ff0000"
));

A Complete example

<?php

class SampleDashboard extends StandaloneDashboard { public function buildDashboard(){ $kpi = new KPIComponent ('kpi'); $kpi->setCaption ('Sales'); $kpi->setDimensions (3, 3); $kpi->setValue (42, array( 'numberPrefix' => '$', 'valueTextColor' => '#ff000d' ));

$this->addComponent ($kpi);

} }

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