CodeIgniter Forums

Full Version: use fusioncharts with codeigniter and use database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I try since 7 days to show my data in fusioncharts with isn't work.
but it work when use without codeigniter.

this is whats I make

1) I copie FusionChats in my repository libraries of my root application of codeigniter

2) in my controller,you are

class DevicesStat extends Controller{
function DevicesStat (){
// load controller parent
// Charger un model de devicestat

function byTypeGraphe(){
// charger le plugin de fudion chart
// store data for being displayed on view file
$data['devices']=$this->DevicesByTypeMod->getDevices(); //pour afficher le topten des equipements par type
$data['title']='equipements par type';
$data['header']='Liste des équipements par type';
// load 'users_view' view
$this->load->view('mod_stat/devicesByType_viewGraphe',$data); //pour afficher le graphique

2) in my model

class DevicesByTypeMod extends Model{

function DevicesByTypeMod(){
// call the Model constructor
// load database class and connect to MySQL

public function getDevices()
$sql="SELECT COUNT( * ) AS Nombre_postes,dc.DeviceCategory_Description AS type_device
FROM device d
LEFT JOIN devicecategory dc
ON d.DeviceCategory_ID = dc.DeviceCategory_ID
LEFT JOIN nmid n
on d.device_id = n.object_id
WHERE n.nmid_statusinappliance = 'Active'
GROUP BY d.DeviceCategory_ID
ORDER BY Nombre_postes DESC";
return $devices->result_array();

3) in my view deviceByType_viewGraphe.php

- I include the file include("system/application/libraries/FusionCharts/Code/PHP/Includes/FusionCharts.php");

I call the javascript file

<style type="text/css">

- $strXML = "<chart caption='Nombre de postes ' subCaption=' par type' pieSliceDepth='40' showBorder='1' formatNumberScale='0' numberSuffix=' postes'>";
// Fetch all devices records
foreach($devices as $device)
$strXML .= "<set label='" . $device['type_device'] . "' value='" . $device['Nombre_postes'] . "' />";

//Finally, close <chart> element
$strXML .= "</chart>";

echo renderChart($typeGraphique, "", $strXML, "FactorySum", 1200, 1000, false, false);


but in the result, I have no graph, but a simple word "Chart"
Can somebody help me quickly, I'm very worry


El Forum

I resolved my problem with base_url
in autoload config,you put $autoload['helper'] = array('url');
and in your view,you raplace the url by
$typeGraphique = base_url()."system/application/libraries/FusionCharts/Code/FusionCharts/Column3D.swf";