<script> //生成fushioncharts function showChart(chartType,showDiv,data){ var myChart1= new FusionCharts("<%=request.getContextPath()%>/framework/fusioncharts/"+chartType+".swf?ChartNoDataText=当前没有可展示图形的数据", "myChartId1", "100%", "100%", "0", "0"); myChart1.setDataXML(data); myChart1.setTransparent(true); myChart1.render( showDiv); } $(document).ready( function(){ var resultXml=$("#resultXml").val(); showChart(charType,"div1",resultXml); } ); </script> </head> <body scroll="no" > <s:form action="busiChatDayAction"> <table width="100%" height="100%" border="1"> <tr> <td width="65%" height="50%"> <div id="div1" ></div> <!-- fusioncharts业务类型 --> </td>
在以前的写法中,我总是在$(document).ready()中,增加fusioncharts,也就是页面加载之后加载fusioncharts,但是经常会出现一个问题,那就是报表图形挤在了一起,显示效果根本显示不出来,如果解决呢,解决方法就是在div后面直接跟<script>,不再在$(document).ready页面加载后加载fusioncharts就可以解决问题
<table width="100%" height="100%" border="1"> <tr> <td width="65%" height="50%"> <div id="div1" ></div> <!-- 业务类型 --> <script type="text/javascript"> var myChart1= new FusionCharts("<%=request.getContextPath()%>/framework/fusioncharts/${property.chartStyle}.swf?ChartNoDataText=当前没有可展示图形的数据", "myChartId1", "100%", "100%", "0", "0"); myChart1.setDataXML("${property.resultXml}"); myChart1.setTransparent(true); myChart1.render( "div1"); </script> </td>
时间: 2024-11-05 12:26:14