2010-11-05 4 views
0

Bonjour à tous j'essaie d'utiliser des graphiques de fusion dans Codeigniter. Je viens de suivre l'instruction de http://www.ikawka.com/2008/12/fusion-chart/comment-page-1/FusionCharts dans Codeigniter Erreur: FusionCharts n'est pas défini

Je vois l'erreur

"FusionCharts is not defined"

dans Firebug. Sur la page de vue, je ne voir

"Chart."

dossier Plugin a le fichier nommé fusion_pi.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 
function FusionCharts($chart_type='Column3D', $width = "300", $height = "250"){ 
    require_once('fusion/FusionCharts_Gen.php'); 
    $FC = new FusionCharts($chart_type,$width,$height); 
    $FC->setSWFPath("images/fusioncharts/"); 
    return $FC; 
} 
?> 

Controller:

function index() 
{ 

    // echo "hello world"; 
    $this->load->view("jquery_view"); 


$this->load->plugin('fusion'); 
echo "hi"; 
$FC = FusionCharts("Column3D","520","200"); 
$arrData = array(500, 269, 254, 895, 633); 
foreach($arrData as $i=>$data){ 
    $FC->addChartData($data); 
} 
$strParam="numberSuffix=%; formatNumberScale=0; decimalPrecision=0; xAxisName=Integrated Process Average Score; animation=1"; 
$FC->setChartParams($strParam); 
$FC->setChartMessage("ChartNoDataText=Chart Data not provided; PBarLoadingText=Please Wait.The chart is loading..."); 
echo $FC->renderChart(); 


} 

Vue:

<html> 
    <head> 
     <script type="text/javascript" src="<?php echo base_url();?>js/FusionCharts.js"></script> 
     <script type="text/javascript" src="<?php echo base_url();?>js/jquery-1.3.2.min.js" ></script> 
     <script type="text/javascript" src="<?php echo base_url();?>js/ajax.js" ></script> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

     <title>Untitled Document</title> 
    </head> 

    <body> 
     <?php echo "Rajani". base_url()."js/FusionCharts.js";?> 
     <label for="name">UserName</label> 
     <input type="text" id="name" /> 
     <input type="password" id="pwd" /> 
     <input type="submit" name="submit" id="submit" value="submit" /> 
</body> 
</html> 

J'ai trouvé que la ligne dans le fichier vue: js/Fu sionCharts.js "> ne détecte pas. Quel pourrait être le problème? Besoin d'aide.

Merci.

+0

? serait bien de le regarder ... – tpae

+0

Juste ajouté du code. S'il vous plaît, jetez un oeil. – Raj

Répondre

0

Dans votre contrôleur, essayez:

function index() 
{ 
$this->load->plugin('fusion'); 
$FC = FusionCharts("Column3D","520","200"); 
$arrData = array(500, 269, 254, 895, 633); 
foreach($arrData as $i=>$data){ 
    $FC->addChartData($data); 
} 
$strParam="numberSuffix=%; formatNumberScale=0; decimalPrecision=0; xAxisName=Integrated Process Average Score; animation=1"; 
$FC->setChartParams($strParam); 
$FC->setChartMessage("ChartNoDataText=Chart Data not provided; PBarLoadingText=Please Wait.The chart is loading..."); 
$data['chart'] = $FC->renderChart(); 

$this->load->view("jquery_view", $data); 
} 

votre point de vue, essayez:

<html> 
    <head> 
     <script type="text/javascript" src="<?php echo base_url();?>js/FusionCharts.js"></script> 
     <script type="text/javascript" src="<?php echo base_url();?>js/jquery-1.3.2.min.js" ></script> 
     <script type="text/javascript" src="<?php echo base_url();?>js/ajax.js" ></script> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

     <title>Untitled Document</title> 
    </head> 

    <body> 

     <? echo $chart; ?> 

     <label for="name">UserName</label> 
     <input type="text" id="name" /> 
     <input type="password" id="pwd" /> 
     <input type="submit" name="submit" id="submit" value="submit" /> 
</body> 
</html> 
Code
+0

Il donne une erreur dans le contrôleur $ data ['chart'] = $ FC-> renderChart(); : "Message d'erreur: Impossible d'utiliser une valeur scalaire sous la forme d'un tableau" – Raj

+0

@Raj, vous utilisez le plugin incorrect. Reportez-vous à http://www.ikawka.com/2008/12/fusion-chart/comment-page-1/ et suivez à nouveau les étapes. – tpae

+0

J'ai essayé deux fois et toujours la même erreur. – Raj

Questions connexes