【问题标题】:fusioncharts graph not displayingfusioncharts图表不显示
【发布时间】:2011-12-22 23:32:34
【问题描述】:

我正在使用 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 登录错误,所以不认为是这样。

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

谢谢, 瑞恩

【问题讨论】:

    标签: php mysql charts fusioncharts


    【解决方案1】:

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

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

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

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

    【讨论】:

      猜你喜欢
      • 2011-04-13
      • 1970-01-01
      • 2021-10-15
      • 2023-04-08
      • 1970-01-01
      • 2013-03-16
      • 2014-10-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多