我需要什么:
我遇到的问题:图表正在加载,但数据未加载。
我正在使用sencha文档作为参考指南。
我只想在图表链接中加载数据:http://postimg.org/image/ydbac2soh/
这是我收到的输出链接网址:http://postimg.org/image/5whlpe6wj/
这是折线图代码:
Ext.require('Ext.chart.*');
Ext.require(['Ext.layout.container.Fit', 'Ext.window.MessageBox']);
Ext.define('Employee',{
extend:'Ext.data.Model',
fields:['name','yearOfExperience']
});
var store=Ext.create('Ext.data.Store',{
model:'Employee',
data:[
{ name:'sam', yearOfExperience:12 },
{ name:'ram', yearOfExperience:7 },
{ name:'kim', yearOfExperience:16 },
{ name:'john', yearOfExperience:21 },
{ name:'Mary', yearOfExperience:13 }
]
});
Ext.onReady(function () {
Ext.Msg.alert("hello","all set");
Ext.create('Ext.chart.Chart',
{
width:500,
height:300,
animate:true,
shadow:store,
store:store,
renderTo:Ext.getBody(),
legend: {
position:'right'
},
insertPadding:25,
theme:'Base:gradients',
axes:[
{
title:'years Of Experience',
type:'Numeric',
position:'left',
fields:['yearOfExperience'],
minimum:0,
maximum:30
},
{
title: 'Employee',
type: 'Category',
position:'bottom',
fields:['name']
}
],
series:[
{
type:"line",
xFields: "name",
yField :"yearOfExerince"
}
]
});
});
答案 0 :(得分:0)
尝试将商店设置为:
autoLoad = true;