[EXTENSION] Fusion Charts API Extension - Create and share Charts
#1
Posted 23 April 2010 - 09:48 AM
#2
Posted 24 April 2010 - 11:30 AM
Nice extension to have! I have already added it in the Charting list here.
I have tried to test it out and read manual in ext page, created action: klientas/chart:
public function actionChart()
{
Yii::app()->fusioncharts->setChartOptions( array( 'caption'=>'My Chart', 'xAxisName'=>'Months', 'yAxisName'=>'Revenue' ) );
Yii::app()->fusioncharts->addSet(array('label'=>'July', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'August', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'Jan', 'value'=>'680000'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Jan'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Feb'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Mar'));
}And in the view added:
<?php
$this->widget('ext.fusioncharts.fusionChartsWidget', array(
'chartNoCache'=>true, // disabling chart cache
'chartAction'=>Yii::app()->urlManager->createUrl('game/chart'), // the chart action that we just generated the xml data at
'chartId'=>'mychart')); // If you display more then one chart on a single page then make sure you specify and id
?>When trying to see the view I got the following error:
PHP Error
Description
Array to string conversion
Source File
C:\wamp\www\p2b7\extensions\fusioncharts\Includes\FusionChartsLib.php(1212)
01200: $tempLink=str_replace($pet,$row[$v],$tempLink);
01201: }
01202: }
01203: }
01204: return $tempLink;
01205: }
01206:
01207:
01208: # Conversion of semi colon(;) separeted paramater to XML attribute
01209: function ConvertParamToXMLAttribute($strParam, $isChartParam=false){
01210:
01211: $xmlParam="";
01212: $listArray=explode($this->del,$strParam);
01213: foreach ($listArray as $valueArray) {
01214: $paramValue=explode("=",$valueArray);
01215: if($this->validateParam($paramValue)==true){
01216: # Create parameter set
01217: if( $isChartParam==false){
01218: $xmlParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' ";
01219: }else{
01220: $xmlParam .= $paramValue[0] . "=" . $this->encodeSpecialChars($paramValue[1]) . "&";
01221: }
01222: }
01223: }
01224:
Stack Trace
#0 C:\wamp\www\p2b7\extensions\fusioncharts\Includes\FusionChartsLib.php(1212): explode()
#1 unknown(0): FusionChartsLib->ConvertParamToXMLAttribute()
#2 C:\wamp\www\p2b7\extensions\fusioncharts\fusionCharts.php(752): call_user_func_array()
#3 unknown(0): fusionCharts->__call()
#4 C:\wamp\www\p2b7\extensions\fusioncharts\views\chartjs.php(6): fusionCharts->ConvertParamToXMLAttribute()
#5 C:\wamp\www\p2b7\lib\yii\web\CBaseController.php(123): require()
#6 C:\wamp\www\p2b7\lib\yii\web\CBaseController.php(88): fusionChartsWidget->renderInternal()
#7 C:\wamp\www\p2b7\lib\yii\web\widgets\CWidget.php(214): fusionChartsWidget->renderFile()
#8 C:\wamp\www\p2b7\extensions\fusioncharts\fusionChartsWidget.php(287): fusionChartsWidget->render()
#9 C:\wamp\www\p2b7\lib\yii\web\CBaseController.php(174): fusionChartsWidget->run()
#10 C:\wamp\www\p2b7\views\klientas\list.php(17): KlientasController->widget()
#11 C:\wamp\www\p2b7\lib\yii\web\CBaseController.php(119): require()
#12 C:\wamp\www\p2b7\lib\yii\web\CBaseController.php(88): KlientasController->renderInternal()
#13 C:\wamp\www\p2b7\lib\yii\web\CController.php(748): KlientasController->renderFile()
#14 C:\wamp\www\p2b7\lib\yii\web\CController.php(687): KlientasController->renderPartial()
#15 C:\wamp\www\p2b7\controllers\KlientasController.php(179): KlientasController->render()
#16 C:\wamp\www\p2b7\lib\yii\web\actions\CInlineAction.php(32): KlientasController->actionList()
#17 C:\wamp\www\p2b7\lib\yii\web\CController.php(300): CInlineAction->run()
#18 C:\wamp\www\p2b7\lib\yii\web\filters\CFilterChain.php(129): KlientasController->runAction()
#19 C:\wamp\www\p2b7\lib\yii\web\filters\CFilter.php(41): CFilterChain->run()
#20 C:\wamp\www\p2b7\lib\yii\web\CController.php(999): CAccessControlFilter->filter()
#21 C:\wamp\www\p2b7\lib\yii\web\filters\CInlineFilter.php(59): KlientasController->filterAccessControl()
#22 C:\wamp\www\p2b7\lib\yii\web\filters\CFilterChain.php(126): CInlineFilter->filter()
#23 C:\wamp\www\p2b7\lib\yii\web\CController.php(283): CFilterChain->run()
#24 C:\wamp\www\p2b7\lib\yii\web\CController.php(257): KlientasController->runActionWithFilters()
#25 C:\wamp\www\p2b7\lib\yii\web\CWebApplication.php(320): KlientasController->run()
#26 C:\wamp\www\p2b7\lib\yii\web\CWebApplication.php(120): CWebApplication->runController()
#27 C:\wamp\www\p2b7\lib\yii\base\CApplication.php(135): CWebApplication->processRequest()
#28 C:\wamp\www\p2b7\www\index.php(13): CWebApplication->run()
2010-04-24 19:25:48 Apache/2.2.11 (Win32) PHP/5.3.0 Yii Framework/1.1.2-devAm I doing something wrong?
Greetings
CoLT
#3
Posted 24 April 2010 - 12:53 PM
Yii::app()->fusioncharts->getXMLData(true);
#4
Posted 24 April 2010 - 03:58 PM
Vince., on 24 April 2010 - 12:53 PM, said:
Yii::app()->fusioncharts->getXMLData(true);
Oh thanks, I missed that XML output
Now I get the following message in View - Chart screen:
Error in loading data.
(I use the code posted above this post)
controller/chart:
<chart caption="My Chart" xAxisName="Months" yAxisName="Revenue"> <set label="July" value="680000"/> <set label="August" value="680000"/> <set label="Jan" value="680000"/> − <categories> <category label="Jan"/> <category label="Feb"/> <category label="Mar"/> </categories> </chart>
Greets
CoLT
#5
Posted 24 April 2010 - 11:58 PM
'debugMode' => true
To either the widget instance or the component in the application configuration and refresh the page then copy paste the contents of the debug mode console.
#6
Posted 25 April 2010 - 07:35 AM
Vince., on 24 April 2010 - 11:58 PM, said:
'debugMode' => true
To either the widget instance or the component in the application configuration and refresh the page then copy paste the contents of the debug mode console.
Sorry my mistake
Am, now where do I properly register this extension to full version?
Thanks, great commercial ext!
CoLT
#7
Posted 25 April 2010 - 02:34 PM
#9
Posted 26 April 2010 - 01:03 AM
See http://www.fusioncha...radingEval.html
#10
Posted 26 April 2010 - 04:21 AM
Vince., on 26 April 2010 - 01:03 AM, said:
See http://www.fusioncha...radingEval.html
Oh yeah, now its clear
Clear your browser cache - very important step.
And don't forget Assets directory clear
Its now fully working ext with FusionCharts Evaluation with upgrade instructions
Greetings,
CoLT
#11
Posted 27 April 2010 - 05:02 AM
In "fusionCharts.php" you have to change the code on line 644:
if($v)
to
if(strlen($v) >0)
otherwise you can't set i.e.:
Yii::app()->fusioncharts->setChartOptions(array('showBorder' => '0'));EDIT:
to make chart swf transparent add the following line in the extensions view file (located under: PATH_TO_EXTENSIONS/fusioncharts/views/chartjs.php):
myChart_{$chartID}.setTransparent('{$this->chartTransparent}');
#12
Posted 27 April 2010 - 07:01 AM
#14
Posted 27 April 2010 - 07:22 AM
edit: the SWF file.
#16
Posted 27 April 2010 - 07:39 AM
When chartNoCache set to true this is the url that loads the SWF file:
/yiiframeworkcoil/trunk/hangman/assets/7c7e9835/Charts/ScrollLine2D.swf?&nocache=0.37390400 1272371855
When i set that to false this is the url:
/yiiframeworkcoil/trunk/hangman/assets/7c7e9835/Charts/ScrollLine2D.swf?
#17
Posted 27 April 2010 - 07:41 AM
Vince., on 27 April 2010 - 07:39 AM, said:
When chartNoCache set to true this is the url that loads the SWF file:
/yiiframeworkcoil/trunk/hangman/assets/7c7e9835/Charts/ScrollLine2D.swf?&nocache=0.37390400 1272371855
When i set that to false this is the url:
/yiiframeworkcoil/trunk/hangman/assets/7c7e9835/Charts/ScrollLine2D.swf?
Ah ok, I see. I use the JS version. Does this bring any speed in loading the chart?
#18
Posted 27 April 2010 - 07:43 AM
#19
Posted 10 May 2010 - 01:11 PM
I have this action code in my controller (PostController.php)
public function actionChart()
{
Yii::app()->fusioncharts->setChartOptions(array('caption'=>'My Chart', 'xAxisName'=>'Months', 'yAxisName'=>'Revenue'));
Yii::app()->fusioncharts->addSet(array('label'=>'July', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'August', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'Jan', 'value'=>'680000'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Jan'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Feb'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Mar'));
Yii::app()->fusioncharts->getXMLData(true);
}This is my view (chart.php)
$this->widget('ext.fusioncharts.fusionChartsWidget', array(
'chartNoCache'=>true,
'chartAction'=>Yii::app()->urlManager->createUrl('post/chart'),
'chartId'=>'mychart'));but all I get back is the data in xml format like this:
<chart caption="My Chart" xAxisName="Months" yAxisName="Revenue"> <set label="July" value="680000"/> <set label="August" value="680000"/> <set label="Jan" value="680000"/> − <categories> <category label="Jan"/> <category label="Feb"/> <category label="Mar"/> </categories> </chart>
...no chart...
I'm sure I'm overlooking something...
#20
Posted 10 May 2010 - 01:42 PM
alexb, on 10 May 2010 - 01:11 PM, said:
I have this action code in my controller (PostController.php)
public function actionChart()
{
Yii::app()->fusioncharts->setChartOptions(array('caption'=>'My Chart', 'xAxisName'=>'Months', 'yAxisName'=>'Revenue'));
Yii::app()->fusioncharts->addSet(array('label'=>'July', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'August', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'Jan', 'value'=>'680000'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Jan'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Feb'));
Yii::app()->fusioncharts->addCategory(array('label'=>'Mar'));
Yii::app()->fusioncharts->getXMLData(true);
}This is my view (chart.php)
$this->widget('ext.fusioncharts.fusionChartsWidget', array(
'chartNoCache'=>true,
'chartAction'=>Yii::app()->urlManager->createUrl('post/chart'),
'chartId'=>'mychart'));but all I get back is the data in xml format like this:
<chart caption="My Chart" xAxisName="Months" yAxisName="Revenue"> <set label="July" value="680000"/> <set label="August" value="680000"/> <set label="Jan" value="680000"/> − <categories> <category label="Jan"/> <category label="Feb"/> <category label="Mar"/> </categories> </chart>
...no chart...
I'm sure I'm overlooking something...
have you tried the following?
public function actionChart()
{
Yii::app()->fusioncharts->setChartOptions(array('caption'=>'My Chart', 'xAxisName'=>'Months', 'yAxisName'=>'Revenue'));
Yii::app()->fusioncharts->addSet(array('label'=>'July', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'August', 'value'=>'680000'));
Yii::app()->fusioncharts->addSet(array('label'=>'Jan', 'value'=>'680000'));
Yii::app()->fusioncharts->getXMLData(true);
}

Help
















