Я пытаюсь создать детализацию, используя Fusionchart и PHP из базы данных MySQL. Я работал над каждой ошибкой, и теперь ошибок нет, но я все еще не вижу свою диаграмму.
Пожалуйста, может кто-нибудь сказать мне, что может быть проблема с моим кодом. Ниже приведен код проекта, начинающийся со ссылки с родительской страницы.
$strXML .= "<set name = '".$row['Day']."' value = '".$row['TotOutput']."' link='" . urlencode("Detailed.php?Day=" . $row['Day']) . "'/>";<?php
//We have 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 XT - Database and Drill-Down Example </TITLE>
<SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
</HEAD>
<BODY>
<?php
//This page is invoked from Default.php. When the user clicks on a pie
//slice in Default.php, the factory Id is passed to this page. We need
//to get that factory id, get information from database and then show
//a detailed chart.
//First, get the factory Id
//Request the factory Id from Querystring
$day = $_GET['Day'];
//Connect to database
$link = connectToDB();
//$strXML will be used to store the entire XML document generated
//Generate the chart element string
$strXML = "<graph caption='Peak Electricity Generated ---- for month April 2015' xAxisName='Day' yAxisName='MegaWatts' decimalPrecision='0' formatNumberScale='0' yaxismaxvalue='1000' showNames='1' rotateNames='1'>";
//Now, we get the data for that plant
$strQuery = "select plant_id, peak_generation from daily_report where pdate=" . $day;
$result = mysql_query($strQuery) or die(mysql_error());
//Iterate through each factory
if ($result) {
while($ors = mysql_fetch_array($result)) {
$strQuery = "plant_name from power_plant where plant_id=" . $ors['plant_id'];
$result2 = mysql_query($strQuery) or die(mysql_error());
$ors2 = mysql_fetch_array($result2);//Here, we convert date into a more readable form for set label.
$strXML .= "<set name = '".$ors2['plant_name']."' value = '".$ors['peak_generation']."'/>";
}
}
mysql_close($link);
//Close <chart> element
$strXML .="</graph>";
//Create the chart - Column 2D Chart with data from $strXML
echo renderChart("charts/FCF_Line.swf", "", $strXML, "Daily Output", 1300, 500);
?>
</CENTER>
</BODY>
</HTML>
Задача ещё не решена.
Других решений пока нет …