日期:2014-05-16 浏览次数:20414 次
jsp 页面:
?
需要引入 FusionCharts.js 文件
?
<script type="text/javascript" src="<%=request.getContextPath()%>/si/pages/cardcenter/query/FusionCharts.js" charset="UTF-8"></script>?
?
?
然后需要一个div
?
?
?
在对应的javascript里面:
?
?
dojo.addOnLoad(init); var strXML1="<graph caption='健康卡发卡情况' xAxisName='发卡机构 ' outCnvBaseFontSize='12' yAxisName='' bgColor='' size='24' rotateYAxisName='0' showNames='1' decimalPrecision='0' formatNumberScale='0'>"; var strXML2=""; var strXML3="</graph>"; var strXML4=""; var color=new Array("AFD8F8","F6BD0F","8BBA00","FF8E46","9D080D"); function init(){ queryApply(); } function queryApply(){ //采集点信息 statisticsDs = new unieap.ds.DataStore("statisticsDs"); statisticsDs.setPageSize(10); statisticsDs.setPageNo(1); statisticsDs.getRowSet().reset(); statisticsDs.removeAttributes(); //设置statement模板和参数 statisticsDs.setStatementName("si.cardcenter.statistics"); unieap.Action.queryData(statisticsDs); if(statisticsDs.getRowSet().getRowCount() > 0){ for (i=0;i<statisticsDs.getRowSet().getRowCount();i++){ strXML2+="<set name='"+statisticsDs.rowSet.primary[i].XZQH+"' value='"+statisticsDs.rowSet.primary[i].NUM+"' color='"+color[i]+"' />"; unieap.byId("fakaGrid").setDataStore(statisticsDs); } ------------------------------------------------ 以下为重点: ?strXML4=strXML1+strXML2+strXML3; //拼接好的xml格式数据 var myChart = new FusionCharts("./Column3D.swf", "myChartId", "540", "350"); myChart.setDataXML(strXML4); myChart.render("testrender");//jsp页面中对应的div id } }