Blame view

js/app/views/PlotComponents/PlotBaseAxisForm.js 4.81 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      : PlotBaseAxisForm.js
 * @class   amdaPlotComp.PlotBaseAxisForm
 * @extends amdaPlotComp.PlotStandardForm
 * @brief   Form to define common options of all axes
 * @author  Benjamin Renard
 * @version $Id: PlotBaseAxisForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotBaseAxisForm', {
	extend: 'amdaPlotComp.PlotStandardForm',
	
	showScaleOption  : true,
	showColorOption  : true,
	showRangeOptions : true,
	showTickGridOptions : true,
5f7932b8   Erdogan Furkan   Done
18
19
20
        showTicksNumber: false,
        showTicksSpacing:false,
        showTicksTimeSpacingCombo:false,
abe09878   Benjamin Renard   Add panels and ax...
21
	
5f7932b8   Erdogan Furkan   Done
22
23
24
25
26
27
28
29
30
31
32
        setObject: function (object) {
		this.callParent(arguments);
		this.updateOptions();
        },

        updateOptions : function(){
                var isShowTicksSpacingVisible = this.object.get('axis-grid-specify-ticks-spacing');
                var isShowTicksNumberVisible = this.object.get('axis-grid-specify-ticks-number');

                var isTImeUnitVisible = this.showTicksTimeSpacingCombo && isShowTicksSpacingVisible ;

15977b45   Benjamin Renard   Fix regression wi...
33
34
35
36
37
38
39
		if (this.showTickGridOptions) {
                	this.getForm( ).findField('axis-grid-minor-space').setVisible( isShowTicksSpacingVisible );
                	this.getForm( ).findField('axis-grid-major-space').setVisible( isShowTicksSpacingVisible );
                	this.getForm( ).findField('axis-grid-minor-number').setVisible( isShowTicksNumberVisible);
                	this.getForm( ).findField('axis-grid-major-number').setVisible(isShowTicksNumberVisible);
                	this.getForm( ).findField('axis-tick-time-unit').setVisible( isTImeUnitVisible );
		}
5f7932b8   Erdogan Furkan   Done
40
41
        },

abe09878   Benjamin Renard   Add panels and ax...
42
	getFormItems: function() {
001b0710   Hacene SI HADJ MOHAND   us 6954 ok
43
            var me = this; 
abe09878   Benjamin Renard   Add panels and ax...
44
		var rangeItems = [
afb7b464   Benjamin Renard   Fix decimal preci...
45
46
                this.addStandardFloat2('axis-range-min', 'Min', -Number.MAX_VALUE, Number.MAX_VALUE),
                this.addStandardFloat2('axis-range-max', 'Max', -Number.MAX_VALUE, Number.MAX_VALUE),
abe09878   Benjamin Renard   Add panels and ax...
47
48
49
50
                this.addStandardCheck('axis-range-extend', 'Extend Axis Range')
		];
		
		var legendItems = [
24b02d83   Benjamin Renard   Add definition of...
51
                this.addStandardText('axis-legend-text', 'Text'),
4f728fd9   Erdogan Furkan   For now 2
52
			this.addColorsPicker('axis-legend-color', 'Color', amdaDefaultConfigs.availableColorsNew, 'auto'),
abe09878   Benjamin Renard   Add panels and ax...
53
54
		        this.addStandardFont('axis-legend-font')
		];
5f7932b8   Erdogan Furkan   Done
55
56
57
58
59
60
61
62
63
                var manageTicksFields= function (name, newValue, oldValue){
                        if(newValue){
                                if(name === 'axis-grid-specify-ticks-spacing')
                                        me.getForm( ).findField('axis-grid-specify-ticks-number').setValue(!newValue);
                                else
                                        me.getForm( ).findField('axis-grid-specify-ticks-spacing').setValue(!newValue);
                        }
                        me.updateOptions();
                };
c504df71   Hacene SI HADJ MOHAND   #6954 allegment i...
64

abe09878   Benjamin Renard   Add panels and ax...
65
		var tickGridItems = [
4f728fd9   Erdogan Furkan   For now 2
66
                this.addStandardCombo('axis-tick-position', 'Ticks position', amdaDefaultConfigs.availableTicksPositions),
24b02d83   Benjamin Renard   Add definition of...
67
68
                this.addStandardCheck('axis-tick-showmarks', 'Show tick marks'),
                this.addStandardCheck('axis-grid-major', 'Show major grid'),
42e982bf   Hacene SI HADJ MOHAND   us 6954 ok
69
                this.addStandardCheck('axis-grid-minor', 'Show minor grid')];
5f7932b8   Erdogan Furkan   Done
70
                tickGridItems.push(this.addStandardCheck('axis-grid-specify-ticks-number', 'Specify ticks number', manageTicksFields));
42e982bf   Hacene SI HADJ MOHAND   us 6954 ok
71
72
                tickGridItems.push(this.addStandardInteger('axis-grid-major-number', 'Nb of Major Ticks', 1, Number.MAX_VALUE,true,true));
                tickGridItems.push(this.addStandardInteger('axis-grid-minor-number', 'Nb of Minor Ticks', 1, Number.MAX_VALUE,true,true));
5f7932b8   Erdogan Furkan   Done
73
74
                tickGridItems.push(this.addStandardCheck('axis-grid-specify-ticks-spacing', 'Specify ticks spacing',manageTicksFields));
                tickGridItems.push(this.addStandardCombo('axis-tick-time-unit', 'Time unit', amdaDefaultConfigs.availableTicksTimeUnits));
42e982bf   Hacene SI HADJ MOHAND   us 6954 ok
75
76
                tickGridItems.push(this.addStandardFloat2('axis-grid-major-space', ' Major Ticks Space', 0, Number.MAX_VALUE,true,true));
                tickGridItems.push(this.addStandardFloat2('axis-grid-minor-space', ' Minor Ticks Space', 0, Number.MAX_VALUE,true,true));
abe09878   Benjamin Renard   Add panels and ax...
77
78
		var axisItems = [];
		if (this.showScaleOption)
4f728fd9   Erdogan Furkan   For now 2
79
			axisItems.push(this.addStandardCombo('axis-scale', 'Scale', amdaDefaultConfigs.availableAxisScales));
f34c9c5a   Benjamin Renard   Finalize color pi...
80
		if (this.showColorOption) {
4f728fd9   Erdogan Furkan   For now 2
81
			axisItems.push(this.addColorsPicker('axis-color', 'Color', amdaDefaultConfigs.availableColorsNew, 'auto'));
f34c9c5a   Benjamin Renard   Finalize color pi...
82
		}
abe09878   Benjamin Renard   Add panels and ax...
83
84
85
86
		axisItems.push(this.addStandardFloat('axis-thickness', 'Thickness', 1, 10));
		axisItems.push(this.addStandardCheck('axis-reverse', 'Reverse direction'));
		if (this.showRangeOptions)
			axisItems.push(this.addStandardFieldSet('Range', '', rangeItems));
24b02d83   Benjamin Renard   Add definition of...
87
		axisItems.push(this.addStandardFieldSet('Legend', 'axis-legend-activated', legendItems));
abe09878   Benjamin Renard   Add panels and ax...
88
89
90
91
92
		if (this.showTickGridOptions)
			axisItems.push(this.addStandardFieldSet('Ticks and Grid', '', tickGridItems));
		
		return axisItems;
	}
afb7b464   Benjamin Renard   Fix decimal preci...
93
});