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 () { } }] });
我的小鱼你醒了,
还认识早晨吗?
昨夜你曾经说,
愿夜幕永不开启。
初吻吻别的那个季节,
不是已经哭过了吗?
你的香腮边轻轻滑落的,
是你的泪,还是我的泪。
我的指尖还记忆著,
你慌乱的心跳。
温润的体香里,
那一缕长髮飘飘。
——青青树 《魁拔》
交流群:ASP.NET交流群(2群) 58189568
ExtJs4.2交流群(3群)97869295
分类:
EXTJS 4.2
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决