PlotAxisObject.js
8.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/**
* 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',
idProperty: 'id',
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'},
{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-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'}
],
associations : [
{
type : 'belongsTo',
model : 'amdaPlotObj.PlotPanelObject'
}
],
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;
},
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);
this.set('axis-tick-showmarks', true);
this.set('axis-tick-position', amdaPlotObj.PlotObjectConfig.defaultValues.axis.tickPosition);
this.set('axis-grid-minor-number',1);
this.set('axis-grid-major-number',1);
this.set('axis-grid-minor-space',0);
this.set('axis-grid-major-space',0);
this.set('axis-grid-minor', false);
this.set('axis-grid-specify-ticks-number', false);
this.set('axis-grid-specify-ticks-spacing', false);
this.set('axis-grid-major', false);
this.set('axis-legend-activated', true);
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');
},
isDirty : function()
{
return this.dirty;
},
getJsonValues : function()
{
var axisValues = new Object();
axisValues['id'] = this.get('id');
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');
axisValues['axis-tick-showmarks'] = this.get('axis-tick-showmarks');
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');
axisValues['axis-grid-minor-number']=this.get('axis-grid-minor-number');
axisValues['axis-grid-major-number']=this.get('axis-grid-major-number');
axisValues['axis-grid-specify-ticks-number']=this.get('axis-grid-specify-ticks-number');
axisValues['axis-grid-minor-space']=this.get('axis-grid-minor-space');
axisValues['axis-grid-major-space']=this.get('axis-grid-major-space');
axisValues['axis-grid-specify-ticks-spacing']=this.get('axis-grid-specify-ticks-spacing');
axisValues['axis-legend-activated'] = this.get('axis-legend-activated');
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;
}
});