Blame view

js/app/models/PlotObjects/PlotAxisObject.js 6.4 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
29
30
31
	
	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'},
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'},
abe09878   Benjamin Renard   Add panels and ax...
36
	          {name: 'axis-tick-position', type: 'string'},
24b02d83   Benjamin Renard   Add definition of...
37
38
39
	          {name: 'axis-grid-minor', type: 'boolean'},
	          {name: 'axis-grid-major', type: 'boolean'},
	          {name: 'axis-legend-activated', type: 'boolean'},
abe09878   Benjamin Renard   Add panels and ax...
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
	          {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',
17433635   Benjamin Renard   Add series and sp...
60
                  model : 'amdaPlotObj.PlotPanelObject'
abe09878   Benjamin Renard   Add panels and ax...
61
62
63
              }
    ],
    
a971060f   Benjamin Renard   Fix some bugs
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
    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...
80
81
82
83
84
85
86
87
88
89
    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...
90
    	this.set('axis-tick-showmarks', true);
abe09878   Benjamin Renard   Add panels and ax...
91
92
93
    	this.set('axis-tick-position', amdaPlotObj.PlotObjectConfig.defaultValues.axis.tickPosition);
    	this.set('axis-grid-minor', false);
    	this.set('axis-grid-major', false);
24b02d83   Benjamin Renard   Add definition of...
94
    	this.set('axis-legend-activated', true);
abe09878   Benjamin Renard   Add panels and ax...
95
96
97
98
99
100
101
102
103
104
105
106
107
108
    	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
109
110
111
112
113
    isDirty : function()
    {
    	return this.dirty;
    },
    
17433635   Benjamin Renard   Add series and sp...
114
    getJsonValues : function() 
abe09878   Benjamin Renard   Add panels and ax...
115
116
117
    {
    	var axisValues  = new Object();
    	
fd5552a4   Benjamin Renard   Info for plot ele...
118
    	axisValues['id'] = this.get('id');
abe09878   Benjamin Renard   Add panels and ax...
119
120
121
122
123
124
125
126
    	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...
127
    	axisValues['axis-tick-showmarks'] = this.get('axis-tick-showmarks');
abe09878   Benjamin Renard   Add panels and ax...
128
129
130
    	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');
24b02d83   Benjamin Renard   Add definition of...
131
    	axisValues['axis-legend-activated'] = this.get('axis-legend-activated');
abe09878   Benjamin Renard   Add panels and ax...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
    	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;
    }
});