StackedColumn3DLineDY.swf 效果展示:
一、页面代码
二、XML数据文件内容
三、struts2 框架动态加载内容
Action类增加方法:public void doZscbhzbChart1() throws IOException { // 读取结出中心列表 List zxList = DAO_CheckOut.doSelect( "select * from t_check_out order by sn", new Object[] {}); if (zxList == null) { zxList = new ArrayList(); } List cbkmList = DAO_Dict.getSubLevels("cbkm"); // 成本科目类型 // 添加 综合保障分摊 BN_Dict zhbz = new BN_Dict(); zhbz.setOp_id("zzlx-zhbz"); zhbz.setOp_name("综合保障分摊"); cbkmList.add(zhbz); Map valueMap = DAO_Report.getValueMap(id_ver, "report-zscbhzb"); HttpServletResponse response = ServletActionContext.getResponse(); response.setCharacterEncoding("utf-8"); response.setContentType("text/xml;charset=utf-8"); response.setHeader("Cache-Control", "no-cache"); PrintWriter out = response.getWriter(); out.write(""); out.write(" "); out.flush(); out.close(); }"); for (int i = 0; i < zxList.size(); i++) { BN_CheckOut checkOut = (BN_CheckOut) zxList.get(i); out.write(" "); for (int i = 0; i < cbkmList.size(); i++) { BN_Dict cbkm = (BN_Dict) cbkmList.get(i); out.write(""); } out.write(" "); for (int j = 0; j < zxList.size(); j++) { BN_CheckOut checkOut = (BN_CheckOut) zxList.get(j); out.write(" "); } out.write(""); } out.write("
前台页面请求:
myChart1.setDataURL(escape("/manage/report.do?action=doGdsjrcbChart1"));
struts.xml 无须特殊配置即可使用
四、解决数据重复加载的问题
找到FusionCharts.js,利用js工具格式化为可阅读内容
定位到756行,把内容做如下注释掉即可:
this.options.dataSource = c; xStore[this.id] = g.ajax.get(decodeURIComponent(c), function(a, x) { var b = false; /* g.raiseEvent("DataLoadRequestCompleted", { source:"XmlHttpRequest", url:c, data:a, dataFormat:f, cancelDataLoad:function() { b = true; this.cancelDataLoad = function() { return false; }; return true; }, xmlHttpRequestObject:x }, obj); */ if (b !== true) { obj.setChartData(a, f, e);
五、解决set 中 link 脚本中文乱码问题
out.write("");
在graph节点中设置unescapelinks='0' 属性即可