gpt4 book ai didi

php - fusionchart 不显示图表

转载 作者:行者123 更新时间:2023-11-29 22:58:57 27 4
gpt4 key购买 nike

我想知道为什么我的图表不起作用。我已经完全按照描述做了。我正在尝试根据“peak_ Generation”绘制“日期”。但是当代码运行时,它给出“没有数据可显示”的消息。可以采取什么措施来解决这个问题

<?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>

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

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