【问题标题】:drill down on fuisonchart深入了解 fuisonchart
【发布时间】:2015-03-27 01:18:45
【问题描述】:

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

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

【问题讨论】:

    标签: php mysql dreamweaver fusioncharts


    【解决方案1】:

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

    请参阅 this 回答以帮助您入门。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-22
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多