日期:2014-05-16  浏览次数:20452 次

一个简单的extjs chart练习
做了一个简单的extjs chart练习,数据是从struts后台得到的,一点注意的就是jsonstore的autoLoad属性要设置成true

ChartPanel = Ext.extend(Ext.Panel,{
mydocumentChart:null,
constructor:function() {
this.mydocumentChart = new DocumentChart();
ChartPanel.superclass.constructor.call(this,{
width:600,
height:300,
frame:true,
layout:"fit",
renderTo:"chartPanel",
items:[this.mydocumentChart]
});
}
});
/*****************************************************************************************/
DocumentChart = Ext.extend(Ext.chart.ColumnChart,{
myChartStore:null,
constructor:function() {
this.myChartStore = new ChartStore();
DocumentChart.superclass.constructor.call(this,{
store:this.myChartStore,
url:"ext/resources/charts.swf",
xField:"department",
yField:"documentNumber"
});
}
});
/*****************************************************************************************/
ChartStore = Ext.extend(Ext.data.JsonStore,{
constructor:function() {
  ChartStore.superclass.constructor.call(this,{
  autoLoad:true,
url:"http://139.28.96.10:8080/premanagement3/secure/chart",
root:"documentCounts",
fields:["department","documentNumber"]
});
}
});