[EXTENSION] Fusion Charts API Extension - Create and share Charts

yes, this is pretty much the same code as I was trying with except without the categories, but it still just outputs plain xml onto the screen. I’ve traced code execution inside the getXMLData method and it simply saved the xml into $this->_dataXml and then passes it as an argument to sendChartHeaders, at which point it just prints it and then executes Yii::app()->end(). I’m not sure if that correct or not, since it wont even come back from this function…

Hello,

I have one I18N question here:)

I can’t get yAxis I18N working (special chars: ąčęėįšųūž )

Added: Yii::app()->fusioncharts->useI18N = true; (still no effect)

Maybe you know what’s the problems?

[edit]

How do I add Multi-Series Chart? I can’t get DateSets working:)


$values = array(

       array('value'=>'1'),

       array('value'=>'2'),

       array('value'=>'3'),

       array('value'=>'4'),

       array('value'=>'5'),

       array('value'=>'6'),

       array('value'=>'7'),

    );


Yii::app()->fusioncharts->addDataSet('data_unique_key');

Yii::app()->fusioncharts->addSetToDataSet('data_unique_key', $values);



Thanks

CoLT

Can’t use tooltip break line tag:

e.g.


<set label='John' value='420' tooltext='John Miller&lt;BR&gt;Score: 420&lt;BR&gt;Rank:2'/>


Yii::app()->fusioncharts->addSet(array('label'=>'test', 'value'=>$test, 'toolText'=>'test &lt;br/&gt;'.$perc.'% test'));

CoLT

What operating system your using? Did you add any kind of other headers to the xml output?

Read the documentation it should be:


$options = array('seriesName' => 'Some name'); // must specify series anme

Yii::app()->fusioncharts->addDataSet('data_unique_key', $options);


// To add a set to a data set use

$options = array('value' => 1);

Yii::app()->fusioncharts->addSetToDataSet('data_unique_key', $options);

Should be




Yii::app()->fusioncharts->addSet(array('label'=>'test', 'value'=>$test, 'toolText'=>'test {br}'.$perc.'% test'));



If he returns nothing then maybe there are an error that you did not saw. Turn on error reporting and make sure you can see errors. display_errors set to true.

I’m using Wamp@WinXP for development.

Strange I still cant get it working.

Controller:


		public function actionTestchart()

	{


Yii::app()->fusioncharts->setChartOptions( array( 'caption'=>'test', 'xAxisName'=>'testx', 'yAxisName'=>'testy'));




Yii::app()->fusioncharts->addCategory(array('label'=>'Cat1'));

Yii::app()->fusioncharts->addCategory(array('label'=>'Cat2'));

    

$options = array('seriesName' => 'Series1'); // must specify series anme

Yii::app()->fusioncharts->addDataSet('data_unique_key', $options);

$options = array('seriesName' => 'Series2'); // must specify series anme

Yii::app()->fusioncharts->addDataSet('data_unique_key2', $options);




$options = array('value' => 1);

Yii::app()->fusioncharts->addSetToDataSet('data_unique_key', $options);

$options = array('value' => 2);

Yii::app()->fusioncharts->addSetToDataSet('data_unique_key', $options);


$options = array('value' => 3);

Yii::app()->fusioncharts->addSetToDataSet('data_unique_key2', $options);

$options = array('value' => 4);

Yii::app()->fusioncharts->addSetToDataSet('data_unique_key2', $options);

  

   

Yii::app()->fusioncharts->useI18N = true;


Yii::app()->fusioncharts->getXMLData(true);


	}

View:


<?php


$this->widget('ext.fusioncharts.fusionChartsWidget', array( 

                                                              'chartType'=>'Column2D',

                                                              'chartNoCache'=>true, // disabling chart cache

                                                              'chartAction'=>Yii::app()->urlManager->createUrl('report/testchart'), // the chart action that we just generated the xml data at

                                                              'chartId'=>'course_load')); // If you display more then one chart on a single page then make sure you specify and id                 

?>

XML:




<chart caption="test" xAxisName="testx" yAxisName="testy">

−

<categories>

<category label="Cat1"/>

<category label="Cat2"/>

</categories>

−

<dataset seriesName="Series1">

<set value="1"/>

<set value="2"/>

</dataset>

−

<dataset seriesName="Series2">

<set value="3"/>

<set value="4"/>

</dataset>

</chart>

Chart responses: No data to display.

Other type charts work just fine :]

Still shows {br} instead of new line.

Make sure you cleared your cache as flash are cached in the browser. The {br} worked for me when i tested this and posted the correct code above.

Hello,

Thanks for reply. I have tried to do as you suggest but nothing happens - No data to display is shown (but the XML is generated) - could you try the code I pasted earlier in this thread?

Best regards,

CoLT

OK I think i know what the problem is. Since your displaying a multiple series chart try using ‘MSColumn2D’ as the chartType in the view instead of the current set ‘Column2D’ which works on a single series chart.

Yep, you are definitely right here! MSColumn2D fixed all ;)

Thanks!

[edit]

But one thing bothers me again - Y and X axis does not support local characters :)

CoLT

what charters are u using? I tried it with Hebrew and it worked.

Its lithuanian "ąčęėįšųūž" (caps "ĄČĘĖĮŠŲŪŽ")

In the top it shows normally, but X and Y axes name just "eats" non latin letters.

Best regards,

CoLT

Just a guess but try to add the following code ABOVE the ‘getXMLData’ method:




header ( 'Content-type: text/xml' );

echo pack ( "C3" , 0xef, 0xbb, 0xbf );



Hm, I tried like this:


		$this->_dataXml = "header ( 'Content-type: text/xml' );"; 

		$this->_dataXml = "echo pack ( 'C3' , 0xef, 0xbb, 0xbf );"; 




But no effect :)

Best regards,

CoLT

No no no. just add this code




header ( 'Content-type: text/xml' );

echo pack ( "C3" , 0xef, 0xbb, 0xbf );



as it is! above the code


Yii::app()->fusioncharts->getXMLData(true);



in your controller action.

Woops, I tried it now as you said :) But still no change (but in XML output it shows native characters). Strange behaviour.

Thanks for help!

CoLT

What operating system are you using?

For dev server I use:

Wamp@Windows XP

Thanks

CoLT

To be honest i have no clue. It does work for me on Mac and on windows on linux there are certain issues with UTF8 languages displayed inside flash. I would ask at the fusion charts forums.

Yeah, I also think it could be related with Fusioncharts itself :)

Thanks for help anyway;)

CoLT