大家好我想在Codeigniter中使用融合图表。我只是按照说明进行操作 http://www.ikawka.com/2008/12/fusion-chart/comment-page-1/
我看到了错误
在萤火虫中。在视图页面上我只看到“未定义FusionCharts”
“图表”。
插件文件夹的文件名为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;
}
?>
控制器:
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();
}
查看:
<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>
我发现视图文件中的行:js / FusionCharts.js“&gt; 没有检测到。可能是什么问题? 需要帮助。
感谢。
答案 0 :(得分:0)
在您的控制器中,尝试:
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);
}
在您的观点中,请尝试:
<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>