Blame view

js/app/models/PlotObjects/PlotAxisObject.js 8.02 KB
abe09878   Benjamin Renard   Add panels and ax...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Project      : AMDA-NG
 * Name         : PlotAxisObject.js
 * @class   amdaPlotObj.PlotAxisObject
 * @extends Ext.data.Model
 * @brief   Plot Axis Business Object Definition 
 * @author  Benjamin Renard
 * @version $Id: PlotAxisObject.js benjamin $
 ******************************************************************************
 *    FT Id     :   Date   : Name - Description
 ******************************************************************************
 *	:           :14/08/2015: BRE  - file creation
 */
 
 		
Ext.define('amdaPlotObj.PlotAxisObject', {
	extend: 'Ext.data.Model',
fd5552a4   Benjamin Renard   Info for plot ele...
18
	idProperty: 'id',
abe09878   Benjamin Renard   Add panels and ax...
19
20
21
22
23
24
25
26
27
28
	
	requires: [
	           'amdaPlotObj.PlotObjectConfig'
	],
	
	fields : [
	          {name: 'id', type: 'string'},
	          //axis-type can be : time, y-left, y-right, x, color, epoch
	          {name: 'axis-type', type: 'string'},
	          {name: 'axis-reverse', type: 'boolean'},
f8dfaec8   Hacene SI HADJ MOHAND   rm_6954 in progress
29
                              {name: 'axis-scale', type: 'string'},
abe09878   Benjamin Renard   Add panels and ax...
30
31
	          {name: 'axis-range-min', type: 'float'},
	          {name: 'axis-range-max', type: 'float'},
24b02d83   Benjamin Renard   Add definition of...
32
	          {name: 'axis-range-extend', type: 'boolean'},
abe09878   Benjamin Renard   Add panels and ax...
33
34
	          {name: 'axis-color', type: 'string'},
	          {name: 'axis-thickness', type: 'int'},
24b02d83   Benjamin Renard   Add definition of...
35
	          {name: 'axis-tick-showmarks', type: 'boolean'},
001b0710   Hacene SI HADJ MOHAND   us 6954 ok
36
37
                              {name: 'axis-grid-specify-ticks-number', type: 'boolean'},
                              {name: 'axis-grid-specify-ticks-spacing', type: 'boolean'},
abe09878   Benjamin Renard   Add panels and ax...
38
	          {name: 'axis-tick-position', type: 'string'},
24b02d83   Benjamin Renard   Add definition of...
39
40
	          {name: 'axis-grid-minor', type: 'boolean'},
	          {name: 'axis-grid-major', type: 'boolean'},
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
41
42
43
44
                              {name:'axis-grid-minor-number',type:'int'},
                              {name:'axis-grid-major-number',type:'int'},
                              {name:'axis-grid-major-space',type:'float'},
                              {name:'axis-grid-minor-space',type:'float'},
24b02d83   Benjamin Renard   Add definition of...
45
	          {name: 'axis-legend-activated', type: 'boolean'},
abe09878   Benjamin Renard   Add panels and ax...
46
47
	          {name: 'axis-legend-text', type: 'string'},
	          {name: 'axis-legend-color', type: 'string'},
f8dfaec8   Hacene SI HADJ MOHAND   rm_6954 in progress
48
49
50
51
52
53
54
55
56
57
58
59
60
                              {name: 'axis-legend-font-activated', type: 'boolean'},
                              {name: 'axis-legend-font-name', type: 'string'},
                              {name: 'axis-legend-font-size', type: 'int'},
                              {name: 'axis-legend-font-bold', type: 'boolean'},
                              {name: 'axis-legend-font-italic', type: 'boolean'},
                              //only used for time axis
                              {name: 'axis-time-format', type: 'string'},
                              //only used for epoch axis
                              {name: 'axis-epoch-normalized', type: 'boolean'},
                              //only used for color axis
                              {name: 'axis-color-map', type: 'string'},
                              {name: 'axis-color-minval', type: 'string'},
                              {name: 'axis-color-maxval', type: 'string'}
abe09878   Benjamin Renard   Add panels and ax...
61
62
63
64
65
    ],
    
    associations : [
              {
            	  type  : 'belongsTo',
17433635   Benjamin Renard   Add series and sp...
66
                  model : 'amdaPlotObj.PlotPanelObject'
abe09878   Benjamin Renard   Add panels and ax...
67
68
69
              }
    ],
    
a971060f   Benjamin Renard   Fix some bugs
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
    constructor: function(){
        var me = this;
        me.callParent(arguments);
        if ((arguments.length > 0) && arguments[0])
        {
        	
        }
        else
        {
        	//new object, set default fields values
        	me.setDefaultValues();
        }
        
        this.dirty = false;
    },
    
abe09878   Benjamin Renard   Add panels and ax...
86
87
88
89
90
91
92
93
94
95
    setDefaultValues: function(type)
    {
    	this.set('axis-type', type);
    	this.set('axis-reverse', false);
    	this.set('axis-scale', amdaPlotObj.PlotObjectConfig.defaultValues.axis.scale);
    	this.set('axis-range-min', 0);
    	this.set('axis-range-max', 0);
    	this.set('axis-range-extend', true);
    	this.set('axis-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.color);
    	this.set('axis-thickness', amdaPlotObj.PlotObjectConfig.defaultValues.axis.thickness);
24b02d83   Benjamin Renard   Add definition of...
96
    	this.set('axis-tick-showmarks', true);
abe09878   Benjamin Renard   Add panels and ax...
97
    	this.set('axis-tick-position', amdaPlotObj.PlotObjectConfig.defaultValues.axis.tickPosition);
42e982bf   Hacene SI HADJ MOHAND   us 6954 ok
98
99
                    this.set('axis-grid-minor-number',1);
                    this.set('axis-grid-major-number',1);
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
100
101
                    this.set('axis-grid-minor-space',0);
                    this.set('axis-grid-major-space',0);
abe09878   Benjamin Renard   Add panels and ax...
102
    	this.set('axis-grid-minor', false);
001b0710   Hacene SI HADJ MOHAND   us 6954 ok
103
104
                    this.set('axis-grid-specify-ticks-number', false);
                    this.set('axis-grid-specify-ticks-spacing', false);
abe09878   Benjamin Renard   Add panels and ax...
105
    	this.set('axis-grid-major', false);
24b02d83   Benjamin Renard   Add definition of...
106
    	this.set('axis-legend-activated', true);
abe09878   Benjamin Renard   Add panels and ax...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
    	this.set('axis-legend-text', '');
    	this.set('axis-legend-color', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.color);
    	this.set('axis-legend-font-activated', false);
    	this.set('axis-legend-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.font.name);
    	this.set('axis-legend-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.axis.legend.font.size);
    	this.set('axis-legend-font-bold', false);
    	this.set('axis-legend-font-italic', false);
    	this.set('axis-time-format', amdaPlotObj.PlotObjectConfig.defaultValues.axis.timeFormat);
    	this.set('axis-epoch-normalized', false);
    	this.set('axis-color-map', amdaPlotObj.PlotObjectConfig.defaultValues.axis.colorMap);
    	this.set('axis-color-minval', 'none');
    	this.set('axis-color-maxval', 'none');
    },
    
a971060f   Benjamin Renard   Fix some bugs
121
122
123
124
125
    isDirty : function()
    {
    	return this.dirty;
    },
    
17433635   Benjamin Renard   Add series and sp...
126
    getJsonValues : function() 
abe09878   Benjamin Renard   Add panels and ax...
127
128
129
    {
    	var axisValues  = new Object();
    	
fd5552a4   Benjamin Renard   Info for plot ele...
130
    	axisValues['id'] = this.get('id');
abe09878   Benjamin Renard   Add panels and ax...
131
132
133
134
135
136
137
138
    	axisValues['axis-type'] = this.get('axis-type');
    	axisValues['axis-reverse'] = this.get('axis-reverse');
    	axisValues['axis-scale'] = this.get('axis-scale');
    	axisValues['axis-range-min'] = this.get('axis-range-min');
    	axisValues['axis-range-max'] = this.get('axis-range-max');
    	axisValues['axis-range-extend'] = this.get('axis-range-extend');
    	axisValues['axis-color'] = this.get('axis-color');
    	axisValues['axis-thickness'] = this.get('axis-thickness');
24b02d83   Benjamin Renard   Add definition of...
139
    	axisValues['axis-tick-showmarks'] = this.get('axis-tick-showmarks');
abe09878   Benjamin Renard   Add panels and ax...
140
141
142
    	axisValues['axis-tick-position'] = this.get('axis-tick-position');
    	axisValues['axis-grid-minor'] = this.get('axis-grid-minor');
    	axisValues['axis-grid-major'] = this.get('axis-grid-major');
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
143
144
                    axisValues['axis-grid-minor-number']=this.get('axis-grid-minor-number');
                    axisValues['axis-grid-major-number']=this.get('axis-grid-major-number');
001b0710   Hacene SI HADJ MOHAND   us 6954 ok
145
                    axisValues['axis-grid-specify-ticks-number']=this.get('axis-grid-specify-ticks-number');
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
146
147
                    axisValues['axis-grid-minor-space']=this.get('axis-grid-minor-space');
                    axisValues['axis-grid-major-space']=this.get('axis-grid-major-space');
001b0710   Hacene SI HADJ MOHAND   us 6954 ok
148
                    axisValues['axis-grid-specify-ticks-spacing']=this.get('axis-grid-specify-ticks-spacing');
24b02d83   Benjamin Renard   Add definition of...
149
    	axisValues['axis-legend-activated'] = this.get('axis-legend-activated');
abe09878   Benjamin Renard   Add panels and ax...
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
    	axisValues['axis-legend-text'] = this.get('axis-legend-text');
    	axisValues['axis-legend-color'] = this.get('axis-legend-color');
    	axisValues['axis-legend-font-activated'] = this.get('axis-legend-font-activated');
    	axisValues['axis-legend-font-name'] = this.get('axis-legend-font-name');
    	axisValues['axis-legend-font-size'] = this.get('axis-legend-font-size');
    	axisValues['axis-legend-font-bold'] = this.get('axis-legend-font-bold');
    	axisValues['axis-legend-font-italic'] = this.get('axis-legend-font-italic');

    	if (axisValues['axis-type'] == 'time')
    		axisValues['axis-time-format'] = this.get('axis-time-format');
    	if (axisValues['axis-type'] == 'epoch')
    		axisValues['axis-epoch-normalized'] = this.get('axis-epoch-normalized');
    	if (axisValues['axis-type'] == 'color')
    	{
    		axisValues['axis-color-map'] = this.get('axis-color-map');
    		axisValues['axis-color-minval'] = this.get('axis-color-minval');
    		axisValues['axis-color-maxval'] = this.get('axis-color-maxval');
    	}

    	return axisValues;
    }
});