加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Extjs-Flash报表 柱状图

发布时间:2020-12-15 18:32:24 所属栏目:百科 来源:网络整理
导读:1.效果图 2.list.jsp %@ page language="java" pageEncoding="UTF-8"%%request.setCharacterEncoding("UTF-8");response.setCharacterEncoding("UTF-8");String json = "{totalProperty : 10,root:["+"{month:'1月',number: 20},"+"{month:'2月',number: 80}

1.效果图


2.list.jsp

<%@ page language="java" pageEncoding="UTF-8"%>

<%	
	request.setCharacterEncoding("UTF-8");
	response.setCharacterEncoding("UTF-8");
	String json = "{totalProperty : 10,root:["+
		"{month:'1月',number: 20},"+
		"{month:'2月',number: 80},"+
		"{month:'3月',number: 50},"+
		"{month:'4月',number: 60},"+
		"{month:'5月',number: 45},"+
		"{month:'6月',number: 70},"+
		"{month:'7月',"+
		"{month:'8月',"+
		"{month:'9月',number: 40},"+
		"{month:'10月',number: 30},"+
		"{month:'11月',number: 55},"+
		"{month:'12月',number: 32}]}";
	System.out.print(json);
	response.getWriter().write(json);
%>

3.index.jsp
<%@ page language="java"  pageEncoding="UTF-8"%>
<%	String rootpath = request.getContextPath();%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
	<link rel="stylesheet" type="text/css" href="<%=rootpath%>/ext/resources/css/ext-all.css"/>
	<script type="text/javascript" src="<%=rootpath%>/ext/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="<%=rootpath%>/ext/ext-all.js"></script>
	<script type="text/javascript" src="<%=rootpath%>/ext/ext-lang-zh_CN.js"></script>
	<script type="text/javascript">
		Ext.onReady(function(){
			Ext.QuickTips.init();
			Ext.BLANK_IMAGE_URL = '<%=rootpath%>/ext/resources/images/default/s.gif';
			
			var record = new Ext.data.Record.create([
				{name : 'month'},{name : 'number'}
			]);
			var store = new Ext.data.Store({
				proxy : new Ext.data.HttpProxy({
					url : 'list.jsp'
				}),reader : new Ext.data.JsonReader({
					totalProperty : 'totalProperty',root : 'root',fields: record
				})
			});
			store.load();
			var p = new Ext.Panel({
				title : '月份访问量',width : 500,height : 300,items : [{
		            xtype : 'columnchart',url : '<%=rootpath%>/ext/resources/charts.swf',store : store,xField : 'month',yField : 'number'
		       }]
			});
			var vp = new Ext.Viewport({
				items : [p]
			});
		});

    </script>
  </head>
  <body>
  </body>
</html>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读