前台:

//远程抄表设备下落图表数据
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); } }

版权声明:本文博主原创文章。博客,未经同意不得转载。

Extjs 4 生成饼状图的例子的更多相关文章

  1. JFreeChart框架中生成饼状图上怎样显示数据 [问题点数:40分,结帖人GreenLawn]

    我用JFreeChart框架生成饼状图,但想把数据信息在饼图上显示,是在饼图内部(即圆内)显示!怎样实现啊??  去掉lablepieplot.setLabelGenerator(null);去掉线p ...

  2. php 生成饼状图,折线图,条形图 通用类 2

    生成饼状图,折线图,条形图通用的php类,这里使用的是国外的 HighCharts,前台页面别忘了调用HighCahrt  js HighCharts中文网站  http://www.hcharts. ...

  3. php 生成饼状图,折线图,条形图 通用类

    生成饼状图,折线图,条形图通用的php类,这里使用的是百度 Echart. Echart 官方网站  http://echarts.baidu.com/ <?php class Echarts ...

  4. PHP实现动态生成饼状图 (转载)

    <?php //变量定义,画椭圆弧时的角度大小 define("ANGLELENGTH", 10); /** * 绘制图片 * @param $title 3D图的标题 * ...

  5. PHP实现动态生成饼状图、柱状图和折线图(转载)

    PHP在图像操作方面的表现非常出色,我们只需借助可以免费得到的GD库便可以轻松实现图.表勾画.下面将分别介绍PHP实现的饼状图.折线图和柱状图以 及他们的使用方法,这几段代码的特点就是不需要再把它们复 ...

  6. Echarts生成饼状图、条形图以及线形图 JS封装

    1.在我们开发程序中,经常会用到生成一些报表,比方说饼状图,条形图,折线图等.不多说了,直接上封装好的代码,如下Echarts.js所示 以下代码是封装在Echarts.js文件中 /** * Cre ...

  7. Winform 后台生成饼状图并保存为图片

    .cs代码如下 string ldt_picPath = System.Windows.Forms.Application.StartupPath + @"Pic\" + Item ...

  8. echart生成饼状图

    //绘制图表. echarts.init(document.getElementById('main')).setOption({ tooltip : { trigger: 'item', //触发类 ...

  9. C#应用NPOI实现导出EXcel表格中插入饼状图(可实现动态数据生成)

    一.思路:   1.excel是可以通过NPOI插入图片的: 2.C#通过NPOI生成饼状图: 3.把生成的饼状图以字节流的形式插入到表格 二.看代码: #region 生成饼图图例 /// < ...

随机推荐

  1. Static Function Test

    public class StaticTestCls { public int x = 0; public static int y = 0; private void SetValue_Object ...

  2. C语言malloc和free实现原理

    以下是一段简单的C代码,malloc和free到底做了什么? int main() { char* p = (char*)malloc(32); free(p); return 0; } malloc ...

  3. docker网络-如何让外部网络访问容器资源

    docker网络-如何让外部网络访问容器资源 安装httpd 服务: docker:/root# docker exec -it f63b2633d146 bash bash-4.1# yum ins ...

  4. 网易云课堂_程序设计入门-C语言_第三周:循环_2数字特征值

    2 数字特征值(5分) 题目内容: 对数字求特征值是常用的编码算法,奇偶特征是一种简单的特征值.对于一个整数,从个位开始对每一位数字编号,个位是1号,十位是2号,以此类推.这个整数在第n位上的数字记作 ...

  5. 网易云课堂_程序设计入门-C语言_第六章:数组_1多项式加法

    1 多项式加法(5分) 题目内容: 一个多项式可以表达为x的各次幂与系数乘积的和,比如: 现在,你的程序要读入两个多项式,然后输出这两个多项式的和,也就是把对应的幂上的系数相加然后输出. 程序要处理的 ...

  6. 使用after伪类清除浮动

    使用after伪类清除浮动 .department li:after{ content:"."; height:0; visibility:hidden; display:bloc ...

  7. Igor In the Museum(搜搜搜151515151515******************************************************1515151515151515151515)

    D. Igor In the Museum time limit per test 1 second memory limit per test 256 megabytes input standar ...

  8. linux命令学习(1)

    linux下的文件命名规则 1)除了/ 之外,所有的字符都合法. 2)有些字符最好不用,如空格符.制表符.退格符和字符@ # $ & ( ) - 等. 3)避免使用. 作为普通文件名的第一个字 ...

  9. Linux mint 17中文输入法安装,改动linux mint与windows7双系统启动顺序

    安装好linux mint17后,进入mint系统,首先须要一个比較合适的中文输入法. 一.首先迎来的就是安装中文输入法了,之前听说搜狗为ubuntu kinly定制了输入法,所以就想安装搜狗输入法, ...

  10. 【java读书笔记】——java开篇宏观把控 + HelloWorld

    学完java有一段时间了,一直没有做对应的总结,总认为有一种缺憾.从这篇博客開始,将自己平时的学习笔记进行总结归纳,分享给大家. 这篇博客主要简单的介绍一下java的基础知识,基本的目的是扫盲.原来仅 ...