问题描述
很奇怪的问题,从官网的example抄来的代码运行有问题....alert(3)那句代码没有执行到,注释掉Items就可以看到window以及alert(3)语句的执行。求高手分析为什么不能显示piechart。asp返回的数据:{'data':[{'CreateTime':'2010/7/31 21:10:13','SubTotal':800.00},{'CreateTime':'2010/8/1 9:08:01','SubTotal':1350.00},{'CreateTime':'2010/1/1 9:11:01','SubTotal':500.00},{'CreateTime':'2010/1/1 9:09:02','SubTotal':222.00}],'totalCount':1000} js的代码....alert(111); var ds = new Ext.data.Store({ autoLoad: true, proxy: new Ext.data.HttpProxy({ url: 'GetOrder.aspx' }), reader: new Ext.data.JsonReader({ root: 'data', totalProperty: 'totalCount' }, ['SubTotal', 'CreateTime'] ) }); alert(2); var charwin = new Ext.Window({ width: 450, height: 320, modal: true, autoScroll: true, closeAction: 'close', layout: 'fit', maximizable: false, title: '按类别统计', items: { store: ds, xtype: 'piechart', url: 'js/charts.swf', dataField: 'SubTotal', categoryField: 'CreateTime', extraStyle:{ dataTip:{ border: { color: 0x2e434d, size: 2 }, font: { name: "Arial Black", size: 12, color: 0x000000 }}, //提示框显示字体样式 legend: { display: "bottom", padding: 5, spacing: 2, font: { color: 0x000000, family: "Arial", size: 12 }, border: { size: 1, color: 0x999999 } }} }});alert(3); charwin.show(); 问题补充:suziwen 写道
解决方案
我执行你的代码 没有问题啊我的EXTJS 3.3.1,CHROME,IE8,都可以 // alert(111); var ds = new Ext.data.JsonStore({ fields:['SubTotal', 'CreateTime'], data:[ {'CreateTime':'2010/7/31 21:10:13','SubTotal':800.00}, {'CreateTime':'2010/8/1 9:08:01','SubTotal':1350.00}, {'CreateTime':'2010/1/1 9:11:01','SubTotal':500.00}, {'CreateTime':'2010/1/1 9:09:02','SubTotal':222.00} ] } ); //alert(2); var charwin = new Ext.Window({ width: 450, height: 320, modal: true, autoScroll: true, closeAction: 'close', layout: 'fit', maximizable: false, title: '按类别统计', items: { store: ds, xtype: 'piechart', url: '../../resources/charts.swf', dataField: 'SubTotal', categoryField: 'CreateTime', extraStyle: { dataTip: { border: { color: 0x2e434d, size: 2 }, font: { name: "Arial Black", size: 12, color: 0x000000 } }, //提示框显示字体样式 legend: { display: "bottom", padding: 5, spacing: 2, font: { color: 0x000000, family: "Arial", size: 12 }, border: { size: 1, color: 0x999999 } } } } }); //alert(3); charwin.show();
解决方案二:
extjs 版本