Blame view

js/app/models/PlotObjects/PlotAxisObject.js 7.37 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
	
abe09878   Benjamin Renard   Add panels and ax...
20
	fields : [
5f7932b8   Erdogan Furkan   Done
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
				{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'},
								{name: 'axis-scale', type: 'string'},
				{name: 'axis-range-min', type: 'float'},
				{name: 'axis-range-max', type: 'float'},
				{name: 'axis-range-extend', type: 'boolean'},
				{name: 'axis-color', type: 'string'},
				{name: 'axis-thickness', type: 'int'},
				{name: 'axis-tick-showmarks', type: 'boolean'},
				{name: 'axis-grid-specify-ticks-number', type: 'boolean'},
				{name: 'axis-grid-specify-ticks-spacing', type: 'boolean'},
				{name: 'axis-tick-time-unit', type: 'string'},
				{name: 'axis-tick-position', type: 'string'},
				{name: 'axis-grid-minor', type: 'boolean'},
				{name: 'axis-grid-major', type: 'boolean'},
				{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'},
				{name: 'axis-legend-activated', type: 'boolean'},
				{name: 'axis-legend-text', type: 'string'},
				{name: 'axis-legend-color', type: 'string'},
				{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...
58
59
60
61
62
    ],
    
    associations : [
              {
            	  type  : 'belongsTo',
17433635   Benjamin Renard   Add series and sp...
63
                  model : 'amdaPlotObj.PlotPanelObject'
abe09878   Benjamin Renard   Add panels and ax...
64
65
66
              }
    ],
    
a971060f   Benjamin Renard   Fix some bugs
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
    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...
83
84
85
86
    setDefaultValues: function(type)
    {
    	this.set('axis-type', type);
    	this.set('axis-reverse', false);
b1dc2eb3   Erdogan Furkan   More modifications
87
    	this.set('axis-scale', amdaDefaultValues.plot.axis.scale);
abe09878   Benjamin Renard   Add panels and ax...
88
89
90
    	this.set('axis-range-min', 0);
    	this.set('axis-range-max', 0);
    	this.set('axis-range-extend', true);
b1dc2eb3   Erdogan Furkan   More modifications
91
92
    	this.set('axis-color', amdaDefaultValues.plot.axis.color);
    	this.set('axis-thickness', amdaDefaultValues.plot.axis.thickness);
24b02d83   Benjamin Renard   Add definition of...
93
    	this.set('axis-tick-showmarks', true);
b1dc2eb3   Erdogan Furkan   More modifications
94
    	this.set('axis-tick-position', amdaDefaultValues.plot.axis.tickPosition);
42e982bf   Hacene SI HADJ MOHAND   us 6954 ok
95
96
                    this.set('axis-grid-minor-number',1);
                    this.set('axis-grid-major-number',1);
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
97
98
                    this.set('axis-grid-minor-space',0);
                    this.set('axis-grid-major-space',0);
abe09878   Benjamin Renard   Add panels and ax...
99
    	this.set('axis-grid-minor', false);
001b0710   Hacene SI HADJ MOHAND   us 6954 ok
100
101
                    this.set('axis-grid-specify-ticks-number', false);
                    this.set('axis-grid-specify-ticks-spacing', false);
5f7932b8   Erdogan Furkan   Done
102
		this.set('axis-tick-time-unit',amdaDefaultValues.plot.axis.tickTimeUnit);
abe09878   Benjamin Renard   Add panels and ax...
103
    	this.set('axis-grid-major', false);
24b02d83   Benjamin Renard   Add definition of...
104
    	this.set('axis-legend-activated', true);
abe09878   Benjamin Renard   Add panels and ax...
105
    	this.set('axis-legend-text', '');
b1dc2eb3   Erdogan Furkan   More modifications
106
    	this.set('axis-legend-color', amdaDefaultValues.plot.axis.legend.color);
abe09878   Benjamin Renard   Add panels and ax...
107
    	this.set('axis-legend-font-activated', false);
b1dc2eb3   Erdogan Furkan   More modifications
108
109
    	this.set('axis-legend-font-name', amdaDefaultValues.plot.axis.legend.font.name);
    	this.set('axis-legend-font-size', amdaDefaultValues.plot.axis.legend.font.size);
abe09878   Benjamin Renard   Add panels and ax...
110
111
    	this.set('axis-legend-font-bold', false);
    	this.set('axis-legend-font-italic', false);
b1dc2eb3   Erdogan Furkan   More modifications
112
    	this.set('axis-time-format', amdaDefaultValues.plot.axis.timeFormat);
abe09878   Benjamin Renard   Add panels and ax...
113
    	this.set('axis-epoch-normalized', false);
b1dc2eb3   Erdogan Furkan   More modifications
114
    	this.set('axis-color-map', amdaDefaultValues.plot.axis.colorMap);
abe09878   Benjamin Renard   Add panels and ax...
115
116
117
118
    	this.set('axis-color-minval', 'none');
    	this.set('axis-color-maxval', 'none');
    },
    
a971060f   Benjamin Renard   Fix some bugs
119
120
121
122
123
    isDirty : function()
    {
    	return this.dirty;
    },
    
17433635   Benjamin Renard   Add series and sp...
124
    getJsonValues : function() 
abe09878   Benjamin Renard   Add panels and ax...
125
126
127
    {
    	var axisValues  = new Object();
    	
fd5552a4   Benjamin Renard   Info for plot ele...
128
    	axisValues['id'] = this.get('id');
abe09878   Benjamin Renard   Add panels and ax...
129
130
131
132
133
134
135
136
    	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...
137
    	axisValues['axis-tick-showmarks'] = this.get('axis-tick-showmarks');
abe09878   Benjamin Renard   Add panels and ax...
138
139
140
    	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
141
142
                    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
143
                    axisValues['axis-grid-specify-ticks-number']=this.get('axis-grid-specify-ticks-number');
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
144
145
                    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
146
                    axisValues['axis-grid-specify-ticks-spacing']=this.get('axis-grid-specify-ticks-spacing');
5f7932b8   Erdogan Furkan   Done
147
					axisValues['axis-tick-time-unit']= this.get('axis-tick-time-unit');
24b02d83   Benjamin Renard   Add definition of...
148
    	axisValues['axis-legend-activated'] = this.get('axis-legend-activated');
abe09878   Benjamin Renard   Add panels and ax...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
    	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;
    }
});