Application.Dash = function(cfg){
    Ext.apply(this, cfg);
    Application.Dash.superclass.constructor.call(this);
    Application.addModule(this);
};

Ext.extend(Application.Dash, App.Module, {

	id : 'dash',							// linking name in Application
	title : 'Dash',
	description : 'Task for managment',
	icoCls : 'task-ico', 					// used for button
	logoCls : 'task-logo', 					// used for logo	
	
    init : function(){

	},
	
	start : function(){
	
		var $this = this;
		
		var store = new Ext.data.ArrayStore({
			fields: ['month', 'hits'],
			data: this.generateData()
		});
		
		var ret = new Ext.Panel({
			closable: true,
			width: 700,
			height: 400,
			id : $this.id,	
			title : $this.title,
			header: false,
			hideBorders: true,
			tbar: [{
				text: 'Load new data set',
				handler: function(){
					store.loadData($this.generateData());
				}
			}],
			items: {
				xtype: 'columnchart',
				store: store,
				yField: 'hits',
				xField: 'month',
				xAxis: new Ext.chart.CategoryAxis({
					title: 'Month'
				}),
				yAxis: new Ext.chart.NumericAxis({
					title: 'Hits'
				}),
				extraStyle: {
				   xAxis: {
						labelRotation: -15
					}
				}
			}
		});
		
	return ret;

	},
	
	generateData : function(){
		var data = [];
		for(var i = 0; i < 12; ++i){
			data.push([Date.monthNames[i], (Math.floor(Math.random() *  11) + 1) * 100]);
		}
		return data;
	},

	
	_destruct : Ext.emptyFn
	
});
new Application.Dash();