fusionchart不显示图表

fusionchart does not display graph

我想知道为什么我的图表不起作用。我完全按照描述做了。我正在尝试 "date" 反对 "peak_generation"。但当代码为 运行 时,它会给出 "no data to display" 消息。可以做些什么来解决它

<?php
//We've included ../Includes/FusionCharts.php and ../Includes/DBConn.php,      which contains
//functions to help us easily embed the charts and connect to a database.
include("Includes/FusionCharts.php");
include("Includes/DBConn.php");
?>
<HTML>
<HEAD>
<TITLE>
FusionCharts Free - Database Example
</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="js/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>

<CENTER>
<h2><a href="http://www.fusioncharts.com" target="_blank">FusionCharts   Free</a> -Database and Drill-Down Example</h2>


<?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 DB
$link = connectToDB();


// Fetch all factory records

//Iterate through each factory
//if ($result) {
    //
        //Now create a query to get details for this output
        $strQuery = "select SUM(peak_generation) as TotOutput, date as DAYS FROM daily_output GROUP BY date";
        $result = mysql_query($strQuery) or die(mysql_error()); 

        $strXML = "<chart caption='Annual Revenue - last 3 years' numberPrefix='$'>";
        while($row = mysql_fetch_array($result)) {
        //Generate <set name='..' value='..' />        
        $strXML .= "<set label = '".$row['DAYS']."' value = '".$row['TotOutput']."' />";
        }
        //Finally, close <graph> element
        $strXML .= "</chart>";
        //Create the chart - Pie 3D Chart with data from $strXML
        //echo renderChart("charts/FCF_Column3D.swf", "", $strXML, "FactorySum", 650, 450);
        echo renderChart("charts/FCF_Column3D.swf", "", $strXML, "annual_revenue", 600, 300);


        //free the resultset
        mysql_free_result($result);
//  }
//  }




    mysql_close($link);
?>




<BR><BR>
<a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
<H5 ><a href='../default.htm'>&laquo; Back to list of examples</a></h5>
</CENTER>
</BODY>
</HTML>

请注意,如果使用的是FusionCharts Free,请将<chart> </chart>修改为<graph></graph>