This extension encapsulates the jQuery flot graph library see flot

Flot says:
Flot is a pure Javascript plotting library for jQuery. It produces graphical plots of arbitrary datasets on-the-fly client-side.
The focus is on simple usage (all settings are optional), attractive looks and interactive features like zooming and mouse tracking.
The plugin works with Internet Explorer 6/7/8, Firefox 2.x+, Safari 3.0+, Opera 9.5+ and Konqueror 4.x+ with the HTML canvas tag (the excanvas Javascript emulation helper is used for IE).
protected/extensionsSee the following code example:
<!-- example view for flot graphs --> <h1>Flot</h1> <?php // lines and bars in same graph $this->widget('application.extensions.EFlot.EFlotGraphWidget', array( 'data'=>array( array( 'label'=> 'line', 'data'=>array( array(1,1), array(2,7), array(3,12), array(4,32), array(5,62), array(6,89), ), 'lines'=>array('show'=>true), 'points'=>array('show'=>true), ), array( 'label'=> 'bars', 'data'=>array( array(1,12), array(2,16), array(3,89), array(4,44), array(5,38), ), 'bars'=>array('show'=>true), ), ), 'options'=>array( 'legend'=>array( 'position'=>'nw', 'show'=>true, 'margin'=>10, 'backgroundOpacity'=> 0.5 ), ), 'htmlOptions'=>array( 'style'=>'width:400px;height:400px;' ) ) ); //Pie chart example <?php $format_func = <<<EOD js:function(label, series){ return '<div style="font-size:8pt;text-align:center;padding:2px;color:white;">'+label+'<br/>'+Math.round(series.percent)+'%</div>';} EOD; $this->widget('application.extensions.EFlot.EFlotGraphWidget', array( 'data'=>array( array('label'=>'cows', 'data'=>20), array('label'=>'sheep', 'data'=>20), array('label'=>'chickens', 'data'=>30), ), 'options'=>array( 'series'=> array('pie'=>array( 'show'=>true, 'radius'=> 3/4, 'formatter'=> $format_func, ), ), 'legend'=> array('show'=>false), ), 'htmlOptions'=>array('style'=>'width:400px;height:400px;') ) );
Total 12 comments
how can i add legend into diffenent div with id? by default legend show in main div or i need manually add new div for legend?
Nice extension..it sure does gave me a clear light in the dark.
but may I ask you something? if I would like to modify the label name, X line data becomes month (ex:'Jan','Feb',etc), and Y data becomes Year ('2011','2012',etc). what should I do? is there are any documentation that I can read? Thank You for your kind response.
Hi all,
Mostly I develop an extension when the need arises in one of my own projects. If it works for me then I'm happy, and when I think someone else might benefit I upload it. However, I'll look into updating Eflot, taking heed of the comments here when I have time, which soonest will be next weekend.
Just wondering if there's any plan to update this so that it incorporates the 0.7 release of flot?
Not being the world's greatest expert with either yii or flot it took me a while to realise that the reason one of the options I was specifying wasn't working was because I was reading the documentation for flot 0.7 and using flot 0.6. (I got round it eventually by just downloading flot 0.7 and overwriting the contents of the Eflot/assets directory. The 'yaxis'=>array('show'=>false) option then started working but obviously this might not work for all version related issues.)
Hey,
I'm trying to use a timestamped axis and it's not working (i.e. not generating dates on the x-axis, just the timestamp miliseconds). This might stem from the lack of double-quotes that gets generated for the "time" and "timeformat" options.
Here is my code:
and the script that gets generated on the page looks like:
definitly there is something wrong with the folder naming.. i changed the asset importpath:
so i use EFlot now as foldername
add this plugin to the extension?
http://github.com/ubermajestix/flot-plugins
great documentation.
Sorry about that.. I'll rezip the package so it will create a dir EFlot under extensions.
<Yii::import('application.extensions.EFlot.EFlotWidget');
>Yii::import('application.extensions.Eflot.EFlotWidget');
I should say:
<Yii::import('application.extensions.Eflot.EFlotWidget'); >Yii::import('application.extensions.Eflot.EFlotWidget');
It is not clear that we should make a directory of "Eflot" or "EFlot" under protected/extensions.
This package did not work until I made a directory of "Eflot" and made a modification as follows.
EFlotGraphWidget.php: <Yii::import('application.extensions.EFlot.EFlotWidget');
Leave a comment
Please login to leave your comment.