1
我有以下腳本,渲染圖表與FusionchartFusionchart,XML,使故障
<?php
include("includes/fusioncharts.php");
$chart = new SimpleXMLElement("<chart></chart>");
$chart->addAttribute('caption', 'testgrafiek');
$chart->addAttribute('subcaption', 'onderlabel');
$chart->addAttribute('xaxisname', 'naam');
$chart->addAttribute('yaxisname', 'aantal ronden');
$categories = $chart->addChild('categories');
$category[0] = $categories->addChild('category');
$category[1] = $categories->addChild('category');
$category[0] ->addAttribute('label', 'alias1');
$category[1]->addAttribute('label', 'alias2');
$dataset1 = $chart->addChild('dataset');
$dataset1->addAttribute('seriesname', 'Revenues');
$dataset1det[0] = $dataset1->addChild('set');
$dataset1det[0] ->addAttribute('value', '16000');
$dataset1det[1] = $dataset1->addChild('set');
$dataset1det[1] ->addAttribute('value', '18000');
$dataset2 = $chart->addChild('dataset');
$dataset2->addAttribute('seriesname', 'Profits');
$dataset2->addAttribute('renderas', 'line');
$dataset2det[0] = $dataset2->addChild('set');
$dataset2det[0] ->addAttribute('value', '1000');
$dataset2det[1] = $dataset2->addChild('set');
$dataset2det[1] ->addAttribute('value', '8000');
$columnChart = new FusionCharts("column3D", "myFirstChart" , 700, 400, "chart-1", "xml", $chart);
$columnChart->render();
Header('Content-type: text/xml');
echo $chart->asXML();
?>
<div id="chart-1"><!-- Fusion Charts will render here--></div>
創建一個XML字符串,如果我運行上面的代碼,我有這樣
頁面上的一個錯誤This page contains the following errors:
error on line 7 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.
如果我運行的代碼,而無需
$columnChart = new FusionCharts("column3D", "myFirstChart" , 700, 400, "chart-1", "xml", $chart);
$columnChart->render();
和
我沒有在頁面上的錯誤,看到一個正確的XML。
沒有找到解決辦法。
有人?
檢查您生成的xml。 –