fusionCharts 不能显示的原因

<?php
$xmlData = "<chart palette='2' caption='Product Comparison' showLabels='1' showvalues='0'  numberPrefix='$' showSum='1' decimals='0' useRoundEdges='1' legendBorderAlpha='0'><categories><category label='Product A' /><category label='Product B' /><category label='Product C' /><category label='Product D' />category label='Product E' /></categories><dataset seriesName='2004' color='AFD8F8' showValues='0'><set value='25601.34' /><set value='20148.82' /><set value='17372.76' /><set value='35407.15' /><set value='38105.68' /></dataset><dataset seriesName='2005' color='F6BD0F' showValues='0'><set value='57401.85' /><set value='41941.19' /><set value='45263.37' /><set value='117320.16' /><set value='114845.27' /></dataset><dataset seriesName='2006' color='8BBA00' showValues='0'><set value='45000.65' /><set value='44835.76' /><set value='18722.18' /><set value='77557.31' /><set value='92633.68' /></dataset></chart>";
?>

var xmlData = "<?php echo $xmlData ?>";
var myChart = new FusionCharts("<?php echo Yii::app()->request->baseUrl; ?>/swf/StackedColumn2D.swf","myChartId", "800","600");  
myChart.setDataXML(xmlData);
myChart.render("chartdiv");

如果是通过生成xml,读取xml生成图形,那么会产生很多xml文件。

可以将动态的xml数据赋值给setDataXML方法,但是要注意的是赋值的数据(字符串)必须在同一行内。(也就是不能产生\n等换行符。)

你可能感兴趣的:(FusionCharts)