Hi everybody,
I have a big problem : I'm using code igniter framework and i want to insert FC graphics ! I have already used FC in other website created without framework and it's very great !
I located FusionChart.js in a javascript directory and FusionCharts.php is renamed as FusionCharts_helper.php and is located in helper directory.
My controller :
class Chart extends CI_Controller {
public function __construct()
{
parent::__construct() ;
}
public function index() {
$this->load->helper(array('url','fusioncharts')) ;
$graph_swfFile = base_url().'Charts/Column3D.swf' ;
$graph_width = 450 ;
$graph_height = 250 ;
// Store Name of Products
$arrData[0][1] = "Product A";
$arrData[1][1] = "Product B";
$arrData[2][1] = "Product C";
//Store sales data
$arrData[0][2] = 567500;
$arrData[1][2] = 815300;
$arrData[2][2] = 556800;
$strXML = "<graph caption='Test' numberPrefix=' formatNumberScale='0' decimalPrecision='0'>";
//Convert data to XML and append
foreach ($arrData as $arSubData) {
$strXML .= "<set name='" . $arSubData[1] . "' value='" . $arSubData[2] . "' color='".getFCColor()."' />";
}
//Close <chart> element
$strXML .= "</graph>";
$data['graph'] = renderChart($graph_swfFile, '', $strXML, 'div' , $graph_width, $graph_height, false, false);
$this->load->view('chart_view',$data) ;
}
}
my view :
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<script language="javascript" type="text/javascript" src="<?php echo base_url(); ?>javascript/FusionCharts.js">
</head>
<body>
<?php
echo $graph ;
?>
</body>
</html>
My view source code after refreshing page is :
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<script language="javascript" type="text/javascript" src="http://localhost/FFA/javascript/FusionCharts.js">
</head>
<body>
<!-- START Code Block for Chart div -->
<div id="divDiv">Chart</div><script type="text/javascript" >
<!-- // Instantiate the Chart
var chart_div = new FusionCharts( { "swfUrl" : "http://localhost/FFA/Charts/Column3D.swf", "width" : "450", "height" : "250", "renderAt" : "divDiv", "dataFormat" : "xml", "id" : "div", "dataSource" : "<graph caption='Test' numberPrefix=' formatNumberScale='0' decimalPrecision='0'><set name='Product A' value='567500' color='AFD8F8' /><set name='Product B' value='815300' color='F6BD0F' /><set name='Product C' value='556800' color='8BBA00' /></graph>" } ).render();
// --></script>
<!-- END Script Block for Chart div -->
</body> </html>
the link of FusionCharts.js is ok like the swfUrl. The code seems to be ok but my page is blank !
What is the problem ?
Best reguards
Thibaut