Welcome Guest, Not a member yet? Register   Sign In
use fusioncharts with codeigniter and use database
#1

[eluser]baradji[/eluser]
I try since 7 days to show my data in fusioncharts with codeigniter.it 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
parent::Controller();
// Charger un model de devicestat
$this->load->model('mod_stat/DevicesByTypeMod');

function byTypeGraphe(){
// charger le plugin de fudion chart
$this->load->library('fusioncharts');
// store data for being displayed on view file
$data['devices']=$this->DevicesByTypeMod->getDevices(); //pour afficher le topten des equipements par type
$data['nbDevices']=$this->DevicesByTypeMod->getNbDevices();
$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
parent::Model();
// load database class and connect to MySQL
$this->load->database();
}

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";
$devices=$this->db->query($sql);
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

[removed][removed]
<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

Thx
#2

[eluser]baradji[/eluser]
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";

thx




Theme © iAndrew 2016 - Forum software by © MyBB