嗨,我正在将 fusioncharts 与 PHP 一起使用。我正在从一个数组中生成图表,就像我展示的那样。我没有收到任何错误,但我得到的只是没有图表,而是显示了“图表”一词。
include ('classes/FusionCharts_Gen.php');
$ticketobj = new SupportTickets();
$types = $ticketobj->getIssueTypes();
$FC = new FusionCharts("Column3D","600","300");
# Set Relative Path of chart SWF file.
$FC->setSwfPath("FusionCharts/Charts");
# Define chart attributes
$strParam="caption=Tickets by Issue Type;formatNumberScale=0;decimalPrecision=0";
# Set chart attributes
$FC->setChartParams($strParam);
# Call FusionCharts PHP Class Function to add data from the array
$FC->addChartDataFromArray($types);
# Render the chart
$FC->renderChart();
创建数组
$x = 0;
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC))
{
$issuetype[$x][0] = $row['issue_type_name'];
$issuetype[$x][1] = $row['Total'];
$x++;
}
数组的 var 转储
array(6) {
[0]=> array(2) {
[0]=> string(14) "Advice Request"
[1]=> int(14)
}
[1]=> array(2) {
[0]=> string(27) "Application Failure/Problem"
[1]=> int(37)
}
[2]=> array(2) {
[0]=> string(6) "Backup"
[1]=> int(3)
}
[3]=> array(2) {
[0]=> string(21) "Device Configuration "
[1]=> int(14)
}
[4]=> array(2) {
[2]=> string(6) "E-Mail"
[3]=> int(6)
}
[5]=> array(2) {
[0]=> string(16) "Hardware Failure"
[1]=> int(4)
}
}