ExtJs pie chart 动态数据统计

pie_chart.js

// 必需,ExtJs图标是基于Flash的
Ext.chart.Chart.CHART_URL = 'lib/ext-3.3.1/resources/charts.swf';

Ext.onReady(function(){
var store = new Ext.data.JsonStore({
fields: ['season', 'total'],
// 获取Json数据的URL
url:"show_quota_pie_dao.asp",
// 设置自动获取
autoLoad: true,
root:"dataList"
});

new Ext.Panel({
width: "100%",
height: 768,
title: '需求配额使用情况',
renderTo: 'container',
items: {
store: store,
xtype: 'piechart',
dataField: 'total',
categoryField: 'season',
extraStyle:
{
legend:
{
display: 'bottom',
padding: 5,
font:
{
family: '宋体',
size: 13
}
}
}
}
});
});


show_quota_pie_dao.asp

<!--#INCLUDE FILE = "db/opendb.asa"-->
<!--#INCLUDE FILE = "checkuser.asp"-->
<!--#INCLUDE FILE = "sub/sub_index.asp"-->
<!--#INCLUDE FILE = "baseinfo.asp"-->
<%
sql = "select count(*) as total from t_require_info"
set rs = db.execute(sql)
total = rs("total")

'构造Json数据
response.Write "{'dataList':[ { 'season':'John', 'total':'"&total&"'},{ 'season':'John12', 'total':'50'} ]}"

'清空缓存
response.Flush()
response.End()
%>


show_quota_pie.asp

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Charts</title>
<link rel="stylesheet" type="text/css" href="lib/ext-3.3.1/resources/css/ext-all.css" />
<script type="text/javascript" src="lib/ext-3.3.1/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="lib/ext-3.3.1/ext-all.js"></script>

<script type="text/javascript" src="js/pie_chart.js"></script>

<link rel="stylesheet" type="text/css" href="lib/ext-3.3.1/examples/shared/examples.css" />

</head>
<body>
<script type="text/javascript" src="lib/ext-3.3.1/examples/shared/examples.js"></script><!-- EXAMPLES -->
<div id="container">

</div>

</body>
</html>


无图不给力!
[img]http://dl.iteye.com/upload/picture/pic/84759/edb7db38-eaaa-3657-a88f-7012eaaa3ff9.jpg[/img]
[img]http://dl.iteye.com/upload/picture/pic/84757/7d5b4b45-e2bd-3688-a945-b3edce1e01e3.jpg[/img]
[img]http://dl.iteye.com/upload/picture/pic/84983/f760e397-64a3-3ee4-98f0-ab66b5ee862d.jpg[/img]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值