Extjs 4 生成饼状图实例
来源:互联网 发布:窗口编程用什么软件好 编辑:程序博客网 时间:2024/05/21 11:03
前台:
//远程读取设备去向图表数据var Store1 = new Ext.data.Store({<span style="white-space:pre"></span>proxy:{<span style="white-space:pre"></span>type:'ajax',<span style="white-space:pre"></span>url:'/newmaterial/servlet/GetCountChartGoDatas',<span style="white-space:pre"></span>reader:{<span style="white-space:pre"></span>type:'array'<span style="white-space:pre"></span>}<span style="white-space:pre"></span><span style="white-space:pre"></span>},<span style="white-space:pre"></span>fields:[<span style="white-space:pre"></span>"System",<span style="white-space:pre"></span>{name:"Share",type:"float"}<span style="white-space:pre"></span>]});Store1.load();var mychart1 = new Ext.chart.Chart({<span style="white-space:pre"></span>store:Store1,<span style="white-space:pre"></span>title:'全部物料去向概览',<span style="white-space:pre"></span>width:500,<span style="white-space:pre"></span>height:500,<span style="white-space:pre"></span>insetPadding:50,<span style="white-space:pre"></span>legend:{position:"right"},<span style="white-space:pre"></span>series:[{<span style="white-space:pre"></span>type:'pie',<span style="white-space:pre"></span>field:'Share',<span style="white-space:pre"></span>showInLegend:true,<span style="white-space:pre"></span>highlight:{<span style="white-space:pre"></span>segment:{margin:20}<span style="white-space:pre"></span>},<span style="white-space:pre"></span>label:{<span style="white-space:pre"></span>field:'System',<span style="white-space:pre"></span>display:'rotate',<span style="white-space:pre"></span>contrast:true<span style="white-space:pre"></span>},<span style="white-space:pre"></span>tips:{<span style="white-space:pre"></span>trackMouse:true,<span style="white-space:pre"></span>renderer:function(rec,item){<span style="white-space:pre"></span>this.update(rec.get("System")+':'+rec.get("Share")+'%');<span style="white-space:pre"></span>}<span style="white-space:pre"></span>}<span style="white-space:pre"></span><span style="white-space:pre"></span>}]});
后台:
public class GetCountChartGoDatas extends HttpServlet {/** * @Fields serialVersionUID : */private static final long serialVersionUID = 1L;/** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {request.setCharacterEncoding("utf-8");response.setContentType("text/html");StringBuffer sb = new StringBuffer();NowmaterialDAO nmd = new NowmaterialDAO();MaterialDAO md = new MaterialDAO();List getlist = nmd.getSession().createCriteria(Nowmaterial.class).setProjection(Projections.projectionList().add(Projections.rowCount()).add(Projections.groupProperty("material.msCode"))).list();int total = 0;for (int i = 0; i < getlist.size(); i++) {Object[] row = (Object[]) getlist.get(i);total = total + Integer.parseInt(row[0].toString());}response.setCharacterEncoding("utf-8");sb.append("[");for (int i = 0; i < getlist.size(); i++) {Object[] row = (Object[]) getlist.get(i);List<Material> getonelist = md.findByProperty("msCode", row[1]);sb.append("['" + getonelist.get(0).getMsName() + "',"+ Float.parseFloat(row[0].toString()) + "],");}sb.append("]");int qu = sb.lastIndexOf(",");sb.deleteCharAt(qu);response.getWriter().print(sb.toString());}/** * The doPost method of the servlet. <br> * * This method is called when a form has its tag value method equals to * post. * * @param request * the request send by the client to the server * @param response * the response send by the server to the client * @throws ServletException * if an error occurred * @throws IOException * if an error occurred */public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {doGet(request, response);}}
1 0
- Extjs 4 生成饼状图实例
- extjs实例 ---生成下拉框
- ExtJs饼状图实例
- extjs实例---生成漂亮的表格
- ExtJS 4 实例之数据包
- extjs 表单验证实例
- extjs 表单验证实例
- extjs 表单验证实例
- checkbox的extjs实例
- extjs 表单验证实例
- ExtJs GridPanel 完整实例
- extjs实例 ---学习小记
- Extjs 进度条实例
- Extjs 系列实例一
- Extjs系列实例二
- Extjs系列实例四
- Extjs系列实例三
- ExtJs实例网址
- 【笔记】socket网络编程
- Python压缩文件基本应用代码示例解读
- 使用DNSCrypt解决DNS污染问题
- CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)
- SPEC中定义条件macro(conditional macro)
- Extjs 4 生成饼状图实例
- 数十万外国劳工离境 分析称泰军方欲转移国内注意
- 解决 ubuntu 12.04系统装了qt sdk,在qtcreator里 无法从widget box工具栏里拖动控件到ui编辑器
- 原随州政协主席樊建国受贿558万被判无期徒刑
- 创业故事:我们在办公室睡了6个月...但还是失败了
- Windows窗口消息
- 支付宝快捷支付和网银谁更安全
- Debug模式误用Opencv Release库的错误
- 一入python深似海--tuple和set