所以我想要做的是填充一个 Extjs 折线图。我创建了一个从远程页面提取 json 的 JSON 存储,由于某种原因,我的图表没有被填充。
这是我的分机代码:
Ext.onReady(function(){
var store = new Ext.data.JsonStore({
autoDestroy: true,
url: 'http://myURL.com',
storeId: 'graphStore',
root: 'rows',
idProperty: 'date',
fields: ['date', 'posts']
});
new Ext.Panel({
title: 'Posts',
renderTo: 'test_graph',
width:500,
height:300,
layout:'fit',
items: {
xtype: 'linechart',
store: store,
xField: 'date',
yField: 'posts',
listeners: {
itemclick: function(o){
var rec = store.getAt(o.index);
Ext.example.msg('Item Selected', 'You chose {0}.', rec.get('date'));
}
}
}
});
});
这是应该填充它的 JSON:
{"rows":[
{"date":"2010-06-11","posts":4},
{"date":"2010-06-12","posts":3},
{"date":"2010-06-13","posts":1},
{"date":"2010-06-14","posts":2}
]}
我一生都无法弄清楚为什么这行不通。图形轴显示,但线不呈现。