2014-07-16 87 views
0

我需要什么:没有数据被加载在图表中使用Sencha的Ext JS

  • 当图表加载数据,图表被加载。

问题我正面临着:图表正在加载,但数据未加载。

我使用sencha文档作为参考指南。

  1. 我只想负载数据图表链接:http://postimg.org/image/ydbac2soh/

  2. 这是我得到的URL输出链接: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" 
    } 
    ] 

    }); 

}); 
  • 我在ext js的图表中使用了虚拟数据t加载。
  • 图表加载完美,但数据未加载到图表中,请帮助我在哪里做错了。
  • 我试图用图表中的虚拟数据,但没有数据加载。
  • 以下是输出链接:http://postimg.org/image/5whlpe6wj/
+0

我已经格式化我的代码现在请soolve我的问题。 – user2818060

+0

请告诉我在哪里做错了谢谢sr为实现我的错误 – user2818060

回答

0

尝试店里设置为:

autoLoad = true; 
+0

我已经使用autoLoad:true在商店,但没有数据加载图表 – user2818060