Create thermometer using rgraph

This wiki article has not been tagged with a corresponding Yii version yet.
Help us improve the wiki by updating the version information.

Hi friends,

First I would like to thanks robregonm for it's very nice extension developing

By using this extension we will create a thermometer like on this demo

You can downloaded the Rgraph extesion using this link and create the RGraphThermometer.php on Regraph folder...

 * RGraph Bars class
 * @author Ankit Modi
 * @date 24/07/2013 09:25 AM
class RGraphThermometer extends RGraphWidget
    public function init()
    public function run()
        $id = 'Thermometer' . $this->getId();
        $data = CJSON::encode($this->data);
        $script = "var $id = new RGraph.Thermometer('{$this->getId()}',{$this->data});";
        $script .= $this->getEncodedOptions($id);
        $script .= "{$id}.{$this->drawFunction};";
        $cs = Yii::app()->getClientScript();
        $cs->registerScript($id, $script);

and call the extension using rgraph method..

<div style="text-align: center">
$str = ',00,100,28,';
$str = implode(',', array_filter(explode(',', $str))); // 280,253,279
$this->widget('application.widgets.rgraph.RGraphThermometer', array(
    'options' => array(
        'chart' => array(
            'colors' => array('red'),
            'title.side' => 'This servers target load',
            'gutter' => array(
                'right' => 25,
            //'tooltips'=>array("It's getting <b style='color: red'>hot</b> in her1!"),
#therometer{text-align: center}

Hope it's of some help.

2 0
Viewed: 11 707 times
Version: Unknown (update)
Category: Tips
Written by: Ankit Modi
Last updated by: Ankit Modi
Created on: Aug 13, 2013
Last updated: 9 years ago
Update Article


View all history

Related Articles