cr0t
(Kuznecov Sg)
May 3, 2009, 12:52pm
1
Hello, colleagues.
I would like to introduce my new extension for Yii framework.
Briefly: with this extension you can easy make beauty charts on pages of your Yii application.
More complex story and examples you can find here:
http://summercode.ru/blog/10
and here:
http://summercode.ru…es?forpost=ofc2
Any feedback is appreciated.
P.S. I can’t attach archive with extension to this post, you can download it at http://summercode.ru…art2-0.1.tar.gz
P.P.S. How to add this extension to the Yii extensions repository? (I think this question to Quiang)
StErMi
(Stermi)
May 7, 2009, 7:54am
2
very very nice extension! I will use it
Only one thing:
for usability purpose, if the user has flash disabled you have to show an image that render the flash data information ( like google finance is doing ).
I hope you understand what I was trying to explain
Gimme some feedback on this thing
cr0t
(Kuznecov Sg)
May 7, 2009, 7:58am
3
Thanks!
I'll be think about realization of this functionality.
arsitek
(Chandra Ghv)
May 10, 2009, 1:08am
4
Nice extension!!
But I'm looking for pie chart… I not found this chart on your example…
cr0t
(Kuznecov Sg)
May 10, 2009, 6:11am
5
2arsitek:
I'm just forget to make this type of chart in my example page, in my during project I using this code for pie charts:
<?php
/*
Data array must be like this:
$data = array(
'month'=>'January',
'stats' => array(
'dataField1Value' => 8765,
'dataField2Value' => 324,
'dataField3Value' => 987,
'dataField4Value' => 235),
);
*/
$flashChart = Yii::createComponent('application.extensions.openflashchart2.EOFC2');
foreach($monthsStats as $data)
{
$gData = array();
$gData[1]['value'] = $data['stats']['dataField1Value']; // here you get a value from $data array;
$gData[1]['label'] = 'dataField1Label'; // here you set a name of label
$gData[2]['value'] = $data['stats']['dataField2Value'];
$gData[2]['label'] = 'dataField2Label';
$gData[3]['value'] = $data['stats']['dataField3Value'];
$gData[3]['label'] = 'dataField3Label';
$gData[4]['value'] = $data['stats']['dataField4Value'];
$gData[4]['label'] = 'dataField4Label';
$flashChart->begin();
$flashChart->setTitle($data['month'],'{color:#880a88;font-size:12px;font-weight:bold;padding-bottom:10px;}');
$flashChart->setData($gData, '{n}.value', '{n}.label');
$flashChart->setToolTip($data['month'].'<br>#label# - #val# from #total#');
$flashChart->renderData('pie');
$flashChart->render(250,250);
}
?>
foreach construction was used for displaying some charts on page.
arsitek
(Chandra Ghv)
May 10, 2009, 11:23am
6
Thank you Sergei Kuznecov, I’ll try it…
spamec
(Spamec)
May 21, 2009, 3:28pm
7
Hi everyone, first big thanks to Sergei for great extension… I already have it in my reports
Donno if its the right place to post bugs… maybe I’m wrong but I got one
line 924 instead of
if (isset($options['vertical']) && $options['vertical'] == true)
should be
if (isset($labelsOptions['vertical']) && $labelsOptions['vertical'] == true)
cr0t
(Kuznecov Sg)
May 21, 2009, 4:25pm
8
Tnx!
Right place for bug reporting is here: http://code.google.c…rt/issues/entry , but this place also good for it
I have changed source code as you recommended.
You can checkout (and see instructions how to do it) last version of source code here: http://code.google.c…source/checkout .
You could
Thanks!
Eliovir
(Eliovir)
May 23, 2009, 8:25pm
9
Did you succeed download the image from the Flash? The menu does not work for me, and the example are not clear.
cr0t
(Kuznecov Sg)
May 26, 2009, 6:07pm
10
What kind of menu did you mean? Flash Player menu? I don't know any other method of saving flash movie image rather than [PrtScr] button on keyboard and after that [CTRL+C] in any image editor.
Most complicated thing in examples I think is the understanding how you must prepare data source array for chart type you chose.
Really, I spend half of day for understanding this rules and I tried to write the simplest examples as I can.
Eliovir
(Eliovir)
May 27, 2009, 8:17pm
11
Yes, I'm talking about the Flash Player menu, it does nothing.
In the official website, some demos are about saving, using POST and JavaScript. And they do not work for me.
spamec
(Spamec)
June 1, 2009, 7:06pm
12
Hi Sergei, got one question. Have you managed to set ranges for either positive and negative values on one chart? I tried to find something on http://openflashchart.com/, but nada In addition, I cannot set something like default y axis (on 0).
Ps. I also have small problems with saving chart into image… solution from homepage just doesnt work.
chenc1013
(Chenc1013)
August 26, 2009, 1:21am
13
Fatal error: Class ‘CErrorEvent’ not found in D:\websites\htdocs\uwsys\protected\extensions\openflashchart2\String.php on line 44
why I alway got this… confused… I really want to use it, can someone explain that?
chenc1013
(Chenc1013)
August 26, 2009, 1:28am
14
$instance[0] =& new String();
I got it … delete ‘&’ then I saw it~~, fantastic flash chart haha
a code bug!
cr0t
(Kuznecov Sg)
August 26, 2009, 6:21am
15
Chenc, thank you for your bug report. I’ll change source as soon as I can (when I comes home).
colt
(Linija)
January 3, 2010, 5:42pm
16
Extension is really interesting, but after fixing this error, follows:
PHP Error
Description
Undefined index: outline_colour
Source File
C:\wamp\www\ssis\protected\extensions\yiiopenflashchart\EOFC2.php(667)
00655: */
00656: public function sketch($options = array(), $datasetName = 'default', $chartId = null)
00657: {
00658: if (!is_null($chartId))
00659: {
00660: $this->chartId = $chartId;
00661: }
00662:
00663: if (empty($this->data[$datasetName])) {
00664: return false;
00665: }
00666: $this->Chart->set_bg_colour($this->bg_colour);
00667: $element = new bar_sketch($options['colour'], $options['outline_colour'], $options['fun_factor']);
00668: if (!empty($this->tooltip)) {
00669: $element->set_tooltip($this->tooltip);
00670: }
00671: $numbers = $this->getNumbers($datasetName);
00672: $element->set_values($numbers);
00673: $this->Chart->add_element($element);
00674: return $this->data($this->chartId);
I’m using Yii 1.0.11
colt
(Linija)
April 15, 2010, 3:38pm
17
Are there any news on this Ext?
Maybe connection to DB?
cr0t
(Kuznecov Sg)
April 15, 2010, 4:12pm
18
Hi all.
Sorry, but I have no time for support this extension now (I have free time for yiidebugtoolbar extension bugs fixing only).
I have a lot of job tasks and have no free time for YiiOpenFlashChart.
If you have any ideas and you want to help this projects, I could add you to project members, so you’ll have the ability to commit new code and make changes to source code.
colt
(Linija)
April 25, 2010, 2:26pm
20
Hey,
I can’t find the reason why Sketchometer is not working.
Code from example:
<?php
// SKETCH - my favourite <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/smile.gif' class='bbc_emoticon' alt=':)' />
$flashChart->begin('Sketch Chart');
$flashChart->setTitle('Sketchometer','{color:#880a88;font-size:15px;padding-bottom:20px;}');
$data['1']['Day']['date'] = 'Oct \'09';
$data['1']['Day']['count'] = '321';
$data['2']['Day']['date'] = 'Nov \'09';
$data['2']['Day']['count'] = 345;
$data['3']['Day']['date'] = 'Dec \'09';
$data['3']['Day']['count'] = 500;
$flashChart->setData($data);
$flashChart->setNumbersPath('{n}.Day.count');
$flashChart->setLabelsPath('default.{n}.Day.date');
$flashChart->setLegend('x','Dato');
$flashChart->setLegend('y','Skritt', '{color:#AA0aFF;font-size:12px;}');
$flashChart->axis('x',array('tick_height' => 10,'3d' => -10));
$flashChart->axis('y',array('range' => array(0,600,100)));
$flashChart->renderData('sketch', array(
'colour' => '#81AC00',
'outline-colour' => '#567300',
'offset' => 5,
'fun_factor' => 7,
));
$flashChart->render(200,300);
?>
I get this error in Yii 1.0 and 1.1
PHP Error
Description
Undefined index: outline_colour
Source File
C:\wamp\www\p2b7\extensions\yiiopenflashchart\EOFC2.php(665)
00653: */
00654: public function sketch($options = array(), $datasetName = 'default', $chartId = null)
00655: {
00656: if (!is_null($chartId))
00657: {
00658: $this->chartId = $chartId;
00659: }
00660:
00661: if (empty($this->data[$datasetName])) {
00662: return false;
00663: }
00664: $this->Chart->set_bg_colour($this->bg_colour);
00665: $element = new bar_sketch($options['colour'], $options['outline_colour'], $options['fun_factor']);
00666: if (!empty($this->tooltip)) {
00667: $element->set_tooltip($this->tooltip);
00668: }
00669: $numbers = $this->getNumbers($datasetName);
00670: $element->set_values($numbers);
00671: $this->Chart->add_element($element);
00672: return $this->data($this->chartId);
00673: }
00674:
00675: /**
00676: * This is an alias to FlashChart::chart('pie') that is only used for the
00677: * pie type.
Stack Trace
#0 C:\wamp\www\p2b7\extensions\yiiopenflashchart\EOFC2.php(370): EOFC2->sketch()
#1 C:\wamp\www\p2b7\extensions\yiiopenflashchart\EOFC2.php(212): EOFC2->chart()
#2 C:\wamp\www\p2b7\views\klientas\show.php(147): EOFC2->renderData()
#3 C:\wamp\www\p2b7\lib\yii\web\CBaseController.php(119): require()
#4 C:\wamp\www\p2b7\lib\yii\web\CBaseController.php(88): KlientasController->renderInternal()
#5 C:\wamp\www\p2b7\lib\yii\web\CController.php(748): KlientasController->renderFile()
#6 C:\wamp\www\p2b7\lib\yii\web\CController.php(687): KlientasController->renderPartial()
#7 C:\wamp\www\p2b7\controllers\KlientasController.php(58): KlientasController->render()
#8 C:\wamp\www\p2b7\lib\yii\web\actions\CInlineAction.php(32): KlientasController->actionShow()
#9 C:\wamp\www\p2b7\lib\yii\web\CController.php(300): CInlineAction->run()
#10 C:\wamp\www\p2b7\lib\yii\web\filters\CFilterChain.php(129): KlientasController->runAction()
#11 C:\wamp\www\p2b7\lib\yii\web\filters\CFilter.php(41): CFilterChain->run()
#12 C:\wamp\www\p2b7\lib\yii\web\CController.php(999): CAccessControlFilter->filter()
#13 C:\wamp\www\p2b7\lib\yii\web\filters\CInlineFilter.php(59): KlientasController->filterAccessControl()
#14 C:\wamp\www\p2b7\lib\yii\web\filters\CFilterChain.php(126): CInlineFilter->filter()
#15 C:\wamp\www\p2b7\lib\yii\web\CController.php(283): CFilterChain->run()
#16 C:\wamp\www\p2b7\lib\yii\web\CController.php(257): KlientasController->runActionWithFilters()
#17 C:\wamp\www\p2b7\lib\yii\web\CWebApplication.php(320): KlientasController->run()
#18 C:\wamp\www\p2b7\lib\yii\web\CWebApplication.php(120): CWebApplication->runController()
#19 C:\wamp\www\p2b7\lib\yii\base\CApplication.php(135): CWebApplication->processRequest()
#20 C:\wamp\www\p2b7\www\index.php(13): CWebApplication->run()
2010-04-25 17:16:21 Apache/2.2.11 (Win32) PHP/5.3.0 Yii Framework/1.1.2-dev
When changing outline-colour in sketch chart to outline_colour it’s working again, BUT:
I get the following view:
Also when I use only sketch chart without any other graphs I get the correct view.
Greetings,
CoLT