凌益与零 2013-12-05 02:00
浏览 2775

extjs如何把折线图chart放入到panel中进行显示

Ext.onReady(function() { //创建每月贴现价格统计图 //通过JSON从数据库中获取数据 var chartStore = Ext.create('Ext.data.JsonStore', { fields : [ 'date', 'price1', 'price2', 'price3', 'price4' ], proxy : { type : 'ajax', url : 'chartSearch', reader : { type : 'json' } } }); //四条按交易类别区分的统计线 var monthPriceChart=Ext.create('Ext.chart.Chart', { id:'monthPriceChartid', animate: true, /* renderTo:'LineChart', */ width: 500, height: 300, store : chartStore, axes : [ {//定义坐标轴 title : 'Price', //纵轴标题 type : 'Numeric', position : 'left', fields : [ 'price1','price2','price3','price4'], grid:true, minimum:0 }, { title : 'Day', type : 'Category', position : 'bottom', fields : [ 'date' ] } ], series : [ { type : 'line', highlight:{ size:7, radius:7 }, displayName : '小票买断价', xField : 'date', yField : 'price1', markerConfig:{ type:'cross', size:4, radius:4, 'stroke-width':0 }, style : { color : 0xCCFF00 } }, { type : 'line', highlight:{ size:7, radius:7 }, displayName : '大票买断价', xField : 'date', yField : 'price2', markerConfig:{ type:'circle', size:4, radius:4, 'stroke-width':0 }, style : { color : 0xCC0000 } }, { type : 'line', highlight:{ size:7, radius:7 }, displayName : '当天出款价', xField : 'date', yField : 'price3', markerConfig:{ type:'cross', size:4, radius:4, 'stroke-width':0 }, style : { color : 0x0033FF } }, { type : 'line', highlight:{ size:7, radius:7 }, displayName : '带票价', xField : 'date', yField : 'price4', markerConfig:{ type:'circle', size:4, radius:4, 'stroke-width':0 }, style : { color : 0x66CC00 } } ] }); //创建一个panel var chartPanel = Ext.create('Ext.panel.Panel', { id:'chartPanel', renderTo : Ext.getBody(), title : '价格统计图', layout:'border', border : false, autoScroll:true, tbar : [ '时间', { xtype : 'combo', format : 'Y-M',//显示类型 name : 'month', id : 'month', store : [ '2013-07', '2013-08', '2013-09', '2013-10', '2013-11', '2013-12', '2014-01' ], emptyText : '2013-12', editable : false }, '银行类别:', { xtype : 'combo', name : 'bankType', id : 'bankSearch', store : [ '国股', '北上南宁', '省会城商', '全国城商', '外资', '农商农合', '信用社村镇' ], emptyText : '国股', editable : false }, '-', { text : '查询', handler : function() { chartStore.load({ params : { 'month' : Ext.getCmp('month').getValue(), 'bankType' : Ext.getCmp('bankSearch') .getValue() } }); } } ] }); chartStore.load({ params : { 'month' : '2013-12', 'bankType' : '国股' } }); })

以上是我的页面代码,如何使得折线图chart能够放入到panel中进行显示,我用的是extjs4-2-1版本,求详细解答,谢谢

  • 写回答

0条回答

    报告相同问题?

    悬赏问题

    • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
    • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
    • ¥20 腾讯企业邮箱邮件可以恢复么
    • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
    • ¥15 错误 LNK2001 无法解析的外部符号
    • ¥50 安装pyaudiokits失败
    • ¥15 计组这些题应该咋做呀
    • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
    • ¥15 让node服务器有自动加载文件的功能
    • ¥15 jmeter脚本回放有的是对的有的是错的