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
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.