chart 柱状图

Ext.require('Ext.chart.*');
Ext.require(['Ext.Window', 'Ext.fx.target.Sprite', 'Ext.layout.container.Fit', 'Ext.window.MessageBox']); var store_Watch = new Ext.data.JsonStore({
fields: ['ConversationId', 'ConversationSegContent', 'VotesCount', 'ParticipateCount'],//选项的 SegmentType = 2
data: [{
ConversationId: '1',
ConversationSegContent: '我要去北京哦',
VotesCount: 245000,
ParticipateCount: 3000000
}, {
ConversationId: '2',
ConversationSegContent: '我要去广州哦',
VotesCount: 200,
ParticipateCount: 3500000
}, {
ConversationId: '3',
ConversationSegContent: '我要去上海哦',
VotesCount: 19999,
ParticipateCount: 2000000
}, {
ConversationId: '4',
ConversationSegContent: '我要去深圳哦',
VotesCount: 200000,
ParticipateCount: 3200000
}, {
ConversationId: '5',
ConversationSegContent: '我要去美国哦',
VotesCount: 90000,
ParticipateCount: 3500000
}, {
ConversationId: '6',
ConversationSegContent: '我要去加拿大哦',
VotesCount: 395000,
ParticipateCount: 6800000
}, {
ConversationId: '7',
ConversationSegContent: '我要去火星哦',
VotesCount: 580600,
ParticipateCount: 8500000
}]
}); var chart = Ext.create('Ext.chart.Chart', {
animate: true,
style: 'background:#fff',
shadow: false,
store: store_Watch,
axes: [{
type: 'Numeric',
position: 'bottom',
fields: ['VotesCount'],
label: {
renderer: Ext.util.Format.numberRenderer('0,0')
},
title: '投票项个数',
minimum: 0
}, {
type: 'Category',
position: 'left',
fields: ['ConversationSegContent'],
title: '投票项'
}],
series: [{
type: 'bar',
axis: 'bottom',
tips: {
trackMouse: true,//数据提示框是否跟着鼠标移动
width: 180,//提示框宽度
height: 28,
renderer: function (storeItem, item) {
this.setTitle(storeItem.get('ConversationSegContent') + ' | 投票项个数' + storeItem.get('VotesCount') + ' ');
}
},
label: {
display: 'insideEnd',
field: ['VotesCount'],
renderer: Ext.util.Format.numberRenderer('0'),
orientation: 'horizontal',
color: '#333',
'text-anchor': 'middle',
contrast: true
},
xField: 'ConversationSegContent',
yField: ['VotesCount'],
//color renderer
renderer: function (sprite, record, attr, index, store) {
var fieldValue = Math.random() * 20 + 10;
var value = record.get('VotesCount');
var color;
//var color = ['rgb(213, 70, 121)',
// 'rgb(44, 153, 201)',
// 'rgb(146, 6, 157)',
// 'rgb(49, 149, 0)',
// 'rgb(249, 153, 0)'][value]; //根据数值的不同显示不同的颜色
if (value < 100000) {
color = '#00FF00';
}
else if (value > 100000 && value < 200000) {
color = "#00FFFF";
}
else if (value > 200000 && value < 300000) {
color = '#FF00FF';
}
else if (value > 300000 && value < 400000) {
color = '#FF0060';
}
else if (value > 400000) {
color = '#FF0000';
} return Ext.apply(attr, {
fill: color
});
}
}]
}); var win_Watch = Ext.create('Ext.Window', {
width: 900,
height: 600,
minHeight: 400,
minWidth: 550,
maximizable: true,
title: '投票结果',
layout: "fit", //窗口布局类型
modal: true, //是否模态窗口,默认为false
resizable: false,
closeAction: 'hide',
plain: true,
draggable: true,
border: false,
items: chart,
tbar: [{
text: 'Reload Data',
handler: function () { }
}]
});

EXTJS4.2 chart 柱状图的更多相关文章

  1. Extjs4新特性

    Extjs 4相对于之前的版本作出了重大的修正.其中包括全新的类系统.新平台的引入.API的修整和加强还有新组件的引入(如新的图表和图形组件).Extjs 4提供更快速.更稳定的用户体验,并且让开发人 ...

  2. JfreeChart使用(转载)

    http://www.cnblogs.com/xingyun/ http://www.huosen.net/archives/156.html(此篇除了struts2外,还介绍了servlet下Jfr ...

  3. 【转载】《Ext JS 4 First Look》翻译之一:新特性

    免责声明:     本文转自网络文章,转载此文章仅为个人收藏,分享知识,如有侵权,请联系博主进行删除.     原文作者:^_^肥仔John      原文地址:http://www.cnblogs. ...

  4. android开源项目学习

    FBReaderJ FBReaderJ用于Android平台的电子书阅读器,它支持多种电子书籍格式包括:oeb.ePub和fb2.此外还支持直接读取zip.tar和gzip等压缩文档. 项目地址:ht ...

  5. js相关(easyUI),触发器,ant,jbpm,hibernate二级缓存ehcache,Javamail,Lucene,jqplot,WebService,regex,struts2,oracle表空间

    *********************************************js相关********************************************* // 在指 ...

  6. python模块之XlsxWriter 详解

    Xlsx是python用来构造xlsx文件的模块,可以向excel2007+中写text,numbers,formulas 公式以及hyperlinks超链接. 可以完成xlsx文件的自动化构造,包括 ...

  7. python模块之XlsxWriter

    官网Tutorial:http://xlsxwriter.readthedocs.io/tutorial Xlsx是python用来构造xlsx文件的模块,可以向excel2007+中写text,nu ...

  8. Visifire Chart控件设置 柱状图 条的宽窄

     Chart myChart = new Chart();myChart.DataPointWidth = 5;宽度以PlotArea的百分比为单位,如下例: chart.Width = 500; c ...

  9. Chart图表整合——面积对比图、扇形图、柱状图

    一. chart图表demo网址 网址:http://antv.alipay.com/zh-cn/f2/3.x/demo/index.html 二. 本文主要对面积对比图,扇形图,柱状图三大常见图进行 ...

随机推荐

  1. javascript权威指南(中文版)中的一些错误(一)

    本人目前正在学习js,使用的是javascript权威指南(中文版),学习的时候发现一些细节上的错误,若是我的错误,欢迎指正 1.P11------多了“我们称为 原文为 return Math.sq ...

  2. LeetCode 278

    First Bad Version You are a product manager and currently leading a team to develop a new product. U ...

  3. poj 1364 差分约束

    思路:设dis[i]为从0点到第i点的序列总和.那么对于A B gt  k 来讲意思是dis[B+A]-dis[A]>k; 对于A B lt k来讲就是dis[B+A]-dis[A]<k; ...

  4. Delphi 中的MD5实现方法(转)

    在Delphi自带的Indy控件中其实是提供了MD2,MD4,MD5对象的,我们可以直接使用它们来完成MD5的签名算法.而不需要再去找其它的DLL或是Pas了. 在Uses单元中引用 IdHashMe ...

  5. JavaScript常用的经典小技巧

    1.屏蔽鼠标右键 <--body 方式--> <body oncontextmenu="window.event.returnValue=false"> & ...

  6. 关于oracle误删数据的恢复

    与数据打交道,免不了会误删一些数据,之后还commit了,连回滚的机会都没了,而更糟糕的是你又没有备份,这种事终于在今天被我不幸的遇上了... 唯一一点值得欣慰的是,我删除表记录的时候,时间不长,一天 ...

  7. AutoCAD 2014 win 32bit破解版

    AutoCAD 2014 win 32bit破解版 百度云盘:http://pan.baidu.com/s/1nu2u6Hr

  8. Quartz Scheduler(2.2.1) - Usage of CronTriggers

    Cron is a UNIX tool that has been around for a long time, so its scheduling capabilities are powerfu ...

  9. 关于JAVA System常见类的一些总结

    一.JAVA System类概述 1.概述: System 类是一个抽象类,所有的字段和方法都是静态的,即不能被实例化.其中包含一些有用的类字段和方法,它不能被实例化.在 System 类提供的设施中 ...

  10. Today’s words

    transcendental,transcendental capacity commission,the commission would keep venetian unimodel transi ...