2010-09-28 42 views
2
var encClinic = new Ext.chart.StackedBarChart({ 
    store: new Ext.data.Store({ 
     reader:encReader, 
     url:data.jsonUrl, 
     baseParams:{ 
      cmd:'OHMjson.Graph', 
      graphName:'ENC', 
      graphType:'Clinics' 
     } 
    }), 
    yField: 'CLINIC', 
    xAxis: new Ext.chart.NumericAxis({ 
     stackingEnabled: true, 
     title: text.occurrences 
    }) 
}); 
  1. 我在這裏顯示的一些值,我需要在這裏顯示警告檢索到的數據是否正確與否進行調試。ExtJS的警報幫助

  2. 任何人都可以解釋我的代碼。

+2

只有你知道數據是否正確?如果您想捕獲數據值的問題,我可以添加一個異常偵聽器到商店以捕獲那裏的錯誤,我會添加一個負載偵聽器並在那裏處理記錄。 – Lloyd 2010-09-28 09:27:49

回答

3

這裏是Lloyd正在談論的代碼。我爲你添加了一個異常監聽器和一個負載監聽器。由於我沒有這些數據,records.data內部的細節可能需要進行一些調整才能使其適合您。

var encClinic = new Ext.chart.StackedBarChart({ 
store: new Ext.data.Store({ 
    reader:encReader, 
    url:data.jsonUrl, 
    baseParams:{ 
     cmd:'OHMjson.Graph', 
     graphName:'ENC', 
     graphType:'Clinics' 
    }, 
    listeners : { 
      exception : function(misc) { 
       //Exception Handling Here 
       //Handle your load failures here 
      }, 
      load  : function(this, records, opts) { 
       //evaluate to see if your data is "correct" 
       alert(records.data.toString()); 
      } 

}), 
yField: 'CLINIC', 
xAxis: new Ext.chart.NumericAxis({ 
    stackingEnabled: true, 
    title: text.occurrences 
}) 

});

+0

不要忘記解釋代碼的完整答案。 – 2010-11-08 22:12:32

+0

我添加了評論...被評論的代碼不夠嗎?我認爲這些評論是自足的 – 2010-11-09 14:39:20

+0

我知道這很愚蠢,但是在你的個人資料上+1。 :) – galambalazs 2010-11-10 22:30:38