gpt4 book ai didi

php - 深入了解 fusionchart

转载 作者:行者123 更新时间:2023-11-29 22:55:59 25 4
gpt4 key购买 nike

我创建了两个 php 页面。第一个是主 fusionchart,它绘制了各个工厂的总产量的饼图。我还添加了一个类似的功能,使图表可点击。单击时,它会显示构成图表部分的分割图表分析。但向下钻取图表拒绝绘制任何图表,而是在屏幕上给出一个空图表字符串。我已经放置了代码供您分析。

<?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");
//a file having a list of colors to be applied to each column (using getFCColor() function)
include("/Includes/FC_Colors.php");
?>
<HTML>
<HEAD>
<TITLE> FusionCharts Free - 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
$factoryId = $_GET['factoryId'];

//Connect to database
$link = connectToDB();

//$strXML will be used to store the entire XML document generated
//Generate the chart element string
$strXML = "<chart caption='Factory Output' subCaption='By Quantity' pieSliceDepth='30' showBorder='1' showNames='1' formatNumberScale='0' numberSuffix=' Units' decimalPrecision='0'>";

//Now, we get the data for that factory
$strQuery = "select * from factory_output where factoryId=" . $factoryId;
$result = mysql_query($strQuery) or die(mysql_error());

//Iterate through each factory
if ($result) {
while($ors = mysql_fetch_array($result)) {
//Here, we convert date into a more readable form for set name.
$strXML .="<set name='" . datePart("d",$ors['datePro']) . "/" . datePart("m",$ors['datePro']) . "' value='" . $ors['quantity'] . "' color='" . getFCColor() . "'/>";
}
}
mysql_close($link);

//Close <chart> element
$strXML .="</chart>";

//Create the chart - Column 2D Chart with data from $strXML
echo renderChart("charts/FCF_Column3D.swf", "", $strXML, "FactoryDetailed", 600, 300);
?>
</CENTER>
</BODY>
</HTML>

最佳答案

您必须为数据集设置一个link 属性。

参见this 回答以帮助您入门。

关于php - 深入了解 fusionchart,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28721448/

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