前台:

//远程抄表设备下落图表数据
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. display属性值

    display属性值:none 此元素不会被显示. block 此元素将显示为块级元素,此元素前后会带有换行符. inline 默认.此元素会被显示为内联元素,元素前后没有换行符. inline-bl ...

  2. 宣布正式发布 Windows Azure 移动服务、网站及持续的服务创新

    我们努力创新,向开发人员提供多样化平台以构建最好的云应用程序并在第一时间提供给世界各地的客户.许多新应用程序都属于"现代化应用程序",即始终基于 Web,且可以通过各种移动设备进行 ...

  3. php set env

    SYSTEM WARNING: 'date_default_timezone_get(): It is not safe to rely on the system's timezone settin ...

  4. 滴滴专车司机苹果手机ios客户端可以下载了

    申请过滴滴专车司机的朋友都知道,滴滴专车就是滴滴打车的司机端,但是只有安卓的,一直没有苹果IOS的版本,很多申请通过审核的车主恼于没有IOS版本而暂无法使用滴滴专车司机客户端,也就意味着不能上线接单. ...

  5. linux内核函数库文件的寻找

    linux内核函数的so库文件怎么找呢? 首先还是要产生一个进程的coredump文件的 linux有一个lib-gdb.so库,这个进程的coredump文件中所有load段的最后一个load段中, ...

  6. 《Qt编程的艺术》——8.2 显示目录层次

    现在我们准备通过创建一个小程序来获得关于InterView的实践经验,使用QDirModel和拿来就用的view,来在四个不同的view中显示主目录,如图8.5所示.在代码里,除了例行公事先实例化一个 ...

  7. Thrift使用实例

    首先下载thrift.exe,和对应lib包.注意版本一定要一致. 否则编译会不识别出现错误. 可能会出现org.slf4j这个错误,那么你要把slf4j-api.jar下载下来引入到你的projec ...

  8. CSS3 border属性的妙用

    .ribbon { background: #45c9c8; position: absolute; width: 75px; height: 25px; line-height: 25px; top ...

  9. C# - ADO.Net 调用存储过程

    ------------------------存储过程调用,创建DataSet:----------------------//数据库连接字符串string connStr = @"Dat ...

  10. Chrome 常用快捷键

    20160518     生活常识     Chrome常用操作快捷键 掌握Chrome的常用快捷键,不仅可以节约时间,还能够提高工作效率,最主要还可以装逼.以下是一些常用快捷键: 窗口操作快捷键: ...