2014-07-16 28 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