java fusioncharts_Java FusionCharts实例 柱状图

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值