我想为我的项目使用Fusion Charts,我已经习惯在以下链接中编码:http://www.fusioncharts.com/php-charts/ 问题是当我运行代码时图表不显示。浏览器不断显示此错误:致命错误:调用未定义的函数FusionCharts()
Fatal error: Call to undefined function FusionCharts() in C:\xampp\htdocs\Audit_Project\pie_chart.php on line 15
我该如何解决这个问题?
我的代码:
<?php
include("PDF/fusioncharts.php");
// Create the chart - Column 2D Chart with data given in constructor parameter
// Syntax for the constructor -
new FusionCharts("type of chart",
"unique chart id",
"width of chart",
"height of chart",
"div id to render the chart",
"type of data",
"actual data");
$Chart = new FusionCharts("column2d", "ex1" , 600, 400, "chart-1", "json", '{
"chart":{
"caption":"Harry\'s SuperMart",
"subCaption":"Top 5 stores in last month by revenue",
"numberPrefix":"$",
"theme":"ocean"
},
"data":[
{
"label":"Bakersfield Central",
"value":"880000"
},
{
"label":"Garden Groove harbour",
"value":"730000"
},
{
"label":"Los Angeles Topanga",
"value":"590000"
},
{
"label":"Compton-Rancho Dom",
"value":"520000"
},
{
"label":"Daly City Serramonte",
"value":"330000"
}
]
}');
// Render the chart
$Chart->render();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Home</title>
<script type="text/javascript" src="fusioncharts.js"></script>
<script type="text/javascript" src="fusioncharts.theme.ocean.js"></script>
</head>
<body></body>
</html>
我在代码中错过了“新” 。现在不显示错误。但是,也没有显示图表。它是空白的。 –
您是否将所有内容都传递给其__construct,并调用渲染方法? $ chart->渲染(); – Isty001
是的。我有一个名为(pie_chart.php)的PHP页面,其中包含fusioncharts.php和提到的js库。 –