jsp 页面 :
工作订单计划完成情况统计request.setCharacterEncoding("UTF-8");
%>
var chart = new FusionCharts("../../FusionCharts/charts/FCF_MSColumn3D.swf?ChartNoDataText=没有符合条件的数据!", "ChartId", "600", "350");
chart.setDataURL("getFlashDataByDept.action?arg=");
// chart.setDataURL("ewotest.xml");
chart.render("chartdiv");
action 类 :
package avicit.mes.module.ewofinishstat.action; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; import avicit.mes.module.ewofinishstat.domain.EwoFinishStatService; import com.cape.platform.framework.view.base.ActionBase; public class EwoFinishStatAction extends ActionBase { private EwoFinishStatService ewoFinishStatService; public EwoFinishStatService getEwoFinishStatService() { return ewoFinishStatService; } public void setEwoFinishStatService(EwoFinishStatService ewoFinishStatService) { this.ewoFinishStatService = ewoFinishStatService; } public void getFlashDataByDept() throws UnsupportedEncodingException { HttpServletRequest request = getRequest(); HttpServletResponse response = getResponse(); request.setCharacterEncoding("GBK"); response.setCharacterEncoding("GBK"); response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); Document document = DocumentHelper.createDocument(); Element root = document.addElement("graph"); root.addAttribute("rotateNames", "0"); root.addAttribute("chartLeftMargin", "40"); root.addAttribute("chartTopMargin", "30"); root.addAttribute("chartRightMargin", "40"); root.addAttribute("baseFontSize", "12"); root.addAttribute("baseFont", "宋体"); root.addAttribute("showvalues", "1"); root.addAttribute("caption", "工作订单计划完成情况统计(按部门)"); root.addAttribute("xaxisname", "部门"); //root.addAttribute("yaxisname", "num"); String arg = request.getParameter("arg"); try { if (arg != null && !arg.equals("")) { //对取来的参数进行拆分 String[] temp = arg.split(","); String[] arg0s = { "", ""}; if (temp != null && temp.length > 0) { for (int i = 0; i < temp.length; i++) { arg0s[i] = temp[i]; } } //从后台查询出需要的数据 List ls = ewoFinishStatService.getFlashDataByDept(arg0s[0],arg0s[1]); // 建立图形控件所需的XML元素 Element categories = root.addElement("categories"); for(int i=0;i