gpt4 book ai didi

php - fusioncharts 图表不显示

转载 作者:行者123 更新时间:2023-11-29 09:01:05 29 4
gpt4 key购买 nike

我正在使用 fusionchartsfree 为我的网站创建可视化工具。

我已经调整了示例页面,如下面的代码所示。这在我的 xampp 上 100% 有效,但是在上传(托管在 hostgator 上)时,它无法显示图表。

这是我的代码:

<?php
//We've included ../Includes/FusionCharts_Gen.php, which contains
//FusionCharts PHP Class to help us easily embed charts
//We've also used ../Includes/DBConn.php to easily connect to a database.
include("FusionCharts_Gen.php");
include("DBConn.php");

?>
<HTML>
<HEAD>
<TITLE>
Report Bar Chart
</TITLE>
<?php
//You need to include the following JS file, if you intend to embed the chart using JavaScript.
//Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer
//When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors.
?>
<SCRIPT LANGUAGE="Javascript" SRC="FusionCharts.js"></SCRIPT>
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.text{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-->
</style>
</HEAD>
<BODY>
report
<CENTER>


<?php
//In this example, we show how to connect FusionCharts to a database.
//For the sake of ease, we've used an MySQL databases containing two
//tables.

// Connect to the Database
$link = connectToDB();

# Create pie 3d chart object using FusionCharts PHP Class
$FC = new FusionCharts("Pie3D","650","450");

# Set Relative Path of swf file.
$FC->setSwfPath("FusionCharts/");

//Store chart attributes in a variable for ease of use
$strParam="caption=Factory Output report;subCaption=By Quantity;pieSliceDepth=30; showBorder=1;showNames=1;formatNumberScale=0;numberSuffix= Units;decimalPrecision=0";

# Set chart attributes
$FC->setChartParams($strParam);


// Fetch all factory records usins SQL Query
//Store chart data values in 'total' column/field and category names in 'FactoryName'
$strQuery = "select factory_output.FactoryID as factoryid, factory_master.FactoryName as factoryname, sum(factory_output.Quantity) as total from factory_output, factory_master where factory_output.FactoryId=factory_master.FactoryId group by factory_output.FactoryId,factory_master.FactoryName";
$result = mysql_query($strQuery) or die(mysql_error());

//Pass the SQL Query result to the FusionCharts PHP Class function
//along with field/column names that are storing chart values and corresponding category names
//to set chart data from database
if ($result) {
$FC->addDataFromDatabase($result, "total", "FactoryName");
}
mysql_close($link);

# Render the chart
$FC->renderChart();
?>
</CENTER>
</BODY>
</HTML>

请您告诉我哪里出了问题?正如前面提到的,这适用于我的 xampp,只有数据库的用户名和密码发生了变化,但是我没有收到任何 mysql 登录错误,所以不认为是这样。

或者还有其他易于使用、优雅且可靠的图形包吗?

谢谢,瑞安

最佳答案

检查浏览器的控制台日志是否显示错误。

FusionCharts.js 文件或 SWF 文件可能无法访问。

让我们知道控制台日志中的任何错误。

了解有关调试图表的更多信息 - http://docs.fusioncharts.com/charts/contents/?Debug/Basic.html

关于php - fusioncharts 图表不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8604215/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com