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.

Total 2 comments

#16474 report it
Ankit Modi at 2014/02/26 10:41pm

Thanks robregonm... It's really great extension.

#16469 report it
robregonm at 2014/02/26 10:42am
I will merge this to graph extension

Hi Ankit, This wiki looks great, I will merge it to my rgraph extension. That way you have no need to add anything manually.

Thanks for your contribution.


Leave a comment

Please to leave your comment.

Write new article