songtzu
2011-05-07 13:10
浏览 348
已采纳

extjs chart显示问题

很奇怪的问题,从官网的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();

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • suziwen 2011-05-07 14:54
    已采纳

    我执行你的代码 没有问题啊
    我的EXTJS 3.3.1,
    CHROME,IE8,都可以

    [code="js"]

    // 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();

    [/code]

    评论
    解决 无用
    打赏 举报
查看更多回答(1条)

相关推荐 更多相似问题