2010-09-28 85 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