ydygraphs Dygraphs JavaScript library wrapper Widget.

  1. Requirements
  2. Usage
  3. Resources

Widget/Wrapper for Dygraphs javascript library

Requirements

Yii 1.1.16 (earlier versions may work).

Usage

See YDygraphsExamples.php .

$sampleTimeSeries=new CJavaScriptExpression(
<<<EOJS
function(){
    var r=[];
    var base_time = Date.parse("2008/07/01");
    var num = 24 * 0.25 * 365;
    for (var i = 0; i < num; i++) {
        r.push([ new Date(base_time + i * 3600 * 1000),
         i + 50 * (i % 60),        // line
         i * (num - i) * 4.0 / num  // parabola
        ]);
    }
    return r;
}
EOJS
    );
        
        $this->widget( "ext.YDygraphs.YDygraphs", array(
            'data'=>$sampleTimeSeries,
              'title'=>"Unzoom and Range selector",
              'rollPeriod'=> 7,
              'animatedZooms'=> true,
              'unzoom'=>true,
              'showRangeSelector'=>true,
              //'drawPoints'=>true,
              //'showRoller'=>true,
              // errorBars=> true,
              //'width'=> 600,
              //'height'=> 300,
              'labels'=> ["Date", "a", "b"],
            'htmlOptions'=>array('style'=>'width:100%;'),
            )
         );
     

All options are available at the root and not in a 'options' list so that the options are checked in PHP limiting coding errors. ~~~

Resources

https://github.com/danvk/dygraphs/blob/master/src/dygraph-options-reference.js

1 0
1 follower
73 downloads
Yii Version: 1.1
License: MIT
Category: User Interface
Developed by: le_top
Created on: Dec 25, 2016
Last updated: 7 years ago

Downloads

show all

Related Extensions