EXTJS4.2 chart 柱状图
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 柱状图的更多相关文章
- Extjs4新特性
Extjs 4相对于之前的版本作出了重大的修正.其中包括全新的类系统.新平台的引入.API的修整和加强还有新组件的引入(如新的图表和图形组件).Extjs 4提供更快速.更稳定的用户体验,并且让开发人 ...
- JfreeChart使用(转载)
http://www.cnblogs.com/xingyun/ http://www.huosen.net/archives/156.html(此篇除了struts2外,还介绍了servlet下Jfr ...
- 【转载】《Ext JS 4 First Look》翻译之一:新特性
免责声明: 本文转自网络文章,转载此文章仅为个人收藏,分享知识,如有侵权,请联系博主进行删除. 原文作者:^_^肥仔John 原文地址:http://www.cnblogs. ...
- android开源项目学习
FBReaderJ FBReaderJ用于Android平台的电子书阅读器,它支持多种电子书籍格式包括:oeb.ePub和fb2.此外还支持直接读取zip.tar和gzip等压缩文档. 项目地址:ht ...
- js相关(easyUI),触发器,ant,jbpm,hibernate二级缓存ehcache,Javamail,Lucene,jqplot,WebService,regex,struts2,oracle表空间
*********************************************js相关********************************************* // 在指 ...
- python模块之XlsxWriter 详解
Xlsx是python用来构造xlsx文件的模块,可以向excel2007+中写text,numbers,formulas 公式以及hyperlinks超链接. 可以完成xlsx文件的自动化构造,包括 ...
- python模块之XlsxWriter
官网Tutorial:http://xlsxwriter.readthedocs.io/tutorial Xlsx是python用来构造xlsx文件的模块,可以向excel2007+中写text,nu ...
- Visifire Chart控件设置 柱状图 条的宽窄
Chart myChart = new Chart();myChart.DataPointWidth = 5;宽度以PlotArea的百分比为单位,如下例: chart.Width = 500; c ...
- Chart图表整合——面积对比图、扇形图、柱状图
一. chart图表demo网址 网址:http://antv.alipay.com/zh-cn/f2/3.x/demo/index.html 二. 本文主要对面积对比图,扇形图,柱状图三大常见图进行 ...
随机推荐
- Redis中的关系查询(范围查询,模糊查询等...)
本文部分转自于:http://blog.csdn.net/dc_726/article/details/42784317 本文对Redis如何保存关系型数据,以及如何对其匹配.范围.模糊查询进行举例讲 ...
- 关于同步VSS服务器上的代码发生Eclipse里面的项目全部不见了
有次在同步VSS服务器上的代码的时候突然发生了错误(同步的代码的项目竟然消失了)....如下图 Could not open the editor: The file does not exist. ...
- oracle 中将字符转换为blob 类型
示例如下: select id,mblx,mbmc,TO_BLOB(UTL_RAW.CAST_TO_RAW(mbsj))mbsj,qyid,qycode from tempuser.temp_cwht ...
- Qt之读取配置文件
一.读取配置文件增删功能与修改参数数据 #ifndef CONFIG_H #define CONFIG_H #define QS_FILEPATH "E:\\woo\\Code\\Qt\\A ...
- MyBatis(3.2.3) - Handling enumeration types
MyBatis supports persisting enum type properties out of the box. Assume that the STUDENTS table has ...
- Linux 命令 - umask: 显示或设置文件模式掩码值
umask 命令控制着创建文件时指定给文件的默认权限.它使用八进制表示法从文件模式属性中删除一个位掩码. 参见下面的例子: [huey@huey-K42JE cmdline]$ rm -f foo.t ...
- MSSQL AlwaysOn中的“主角色中的连接”和“可读辅助副本”初探
一.开篇 在进行配置只读路由的时候,需要进行配置可用性组中的可用性副本,如下如所示: 每一项都是啥意思可以看看这个链接 https://msdn.microsoft.com/zh-cn/library ...
- js 后台弹窗
后台弹出操作成功,失败信息 /// <summary> /// 弹出信息,并跳转指定页面. /// </summary> public static void AlertAnd ...
- ios 一个app启动另一个app
问题描述:需要从一个ios应用程序中,能启动另一个ios应用程序. 开发环境:xcode7.3.1 关键词:白名单(LSApplicationQueriesSchemes).注册自己的URL Demo ...
- js 验证电话号 座机及手机号
function CheckTel() { /*验证电话号码 验证规则:区号+号码,区号以0开头,3位或4位号码由7位或8位数字组成 区号与号码之间可以无连接符,也可以“-”连接 如010888888 ...