Upgrade to ExtJS 4.0.2 - Released 06/09/2011
[extjs.git] / src / chart / axis / Abstract.js
1 /*
2
3 This file is part of Ext JS 4
4
5 Copyright (c) 2011 Sencha Inc
6
7 Contact:  http://www.sencha.com/contact
8
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
11
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
13
14 */
15 /**
16  * @class Ext.chart.axis.Abstract
17  * Base class for all axis classes.
18  */
19 Ext.define('Ext.chart.axis.Abstract', {
20
21     /* Begin Definitions */
22
23     requires: ['Ext.chart.Chart'],
24
25     /* End Definitions */
26
27     /**
28      * Creates new Axis.
29      * @param {Object} config (optional) Config options.
30      */
31     constructor: function(config) {
32         config = config || {};
33
34         var me = this,
35             pos = config.position || 'left';
36
37         pos = pos.charAt(0).toUpperCase() + pos.substring(1);
38         //axisLabel(Top|Bottom|Right|Left)Style
39         config.label = Ext.apply(config['axisLabel' + pos + 'Style'] || {}, config.label || {});
40         config.axisTitleStyle = Ext.apply(config['axisTitle' + pos + 'Style'] || {}, config.labelTitle || {});
41         Ext.apply(me, config);
42         me.fields = [].concat(me.fields);
43         this.callParent();
44         me.labels = [];
45         me.getId();
46         me.labelGroup = me.chart.surface.getGroup(me.axisId + "-labels");
47     },
48
49     alignment: null,
50     grid: false,
51     steps: 10,
52     x: 0,
53     y: 0,
54     minValue: 0,
55     maxValue: 0,
56
57     getId: function() {
58         return this.axisId || (this.axisId = Ext.id(null, 'ext-axis-'));
59     },
60
61     /*
62       Called to process a view i.e to make aggregation and filtering over
63       a store creating a substore to be used to render the axis. Since many axes
64       may do different things on the data and we want the final result of all these
65       operations to be rendered we need to call processView on all axes before drawing
66       them.
67     */
68     processView: Ext.emptyFn,
69
70     drawAxis: Ext.emptyFn,
71     addDisplayAndLabels: Ext.emptyFn
72 });
73