PlotBaseAxisForm.js
4.61 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
/**
* 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,
showTicksNumber: false,
showTicksSpacing:false,
getFormItems: function() {
var me = this;
var rangeItems = [
this.addStandardFloat2('axis-range-min', 'Min', -Number.MAX_VALUE, Number.MAX_VALUE),
this.addStandardFloat2('axis-range-max', 'Max', -Number.MAX_VALUE, Number.MAX_VALUE),
this.addStandardCheck('axis-range-extend', 'Extend Axis Range')
];
var legendItems = [
this.addStandardText('axis-legend-text', 'Text'),
this.addStandardColor('axis-legend-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors),
this.addStandardFont('axis-legend-font')
];
var manageTicksNumber = function (name, newValue, oldValue){
me.getForm( ).findField('axis-grid-minor-number').setVisible( newValue);
me.getForm( ).findField('axis-grid-major-number').setVisible( newValue);
if(newValue){
me.getForm( ).findField('axis-grid-specify-ticks-spacing').setValue(!newValue);
}
};
var manageTicksSpacing = function (name, newValue, oldValue){
me.getForm( ).findField('axis-grid-minor-space').setVisible( newValue );
me.getForm( ).findField('axis-grid-major-space').setVisible( newValue );
if(newValue){
me.getForm( ).findField('axis-grid-specify-ticks-number').setValue(!newValue);
}
};
var tickGridItems = [
this.addStandardCombo('axis-tick-position', 'Ticks position', amdaPlotObj.PlotObjectConfig.availableTicksPositions),
this.addStandardCheck('axis-tick-showmarks', 'Show tick marks'),
this.addStandardCheck('axis-grid-major', 'Show major grid'),
this.addStandardCheck('axis-grid-minor', 'Show minor grid')];
tickGridItems.push(this.addStandardCheck('axis-grid-specify-ticks-number', 'Specify ticks number', manageTicksNumber));
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));
tickGridItems.push(this.addStandardCheck('axis-grid-specify-ticks-spacing', 'Specify ticks spacing',manageTicksSpacing));
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));
var axisItems = [];
if (this.showScaleOption)
axisItems.push(this.addStandardCombo('axis-scale', 'Scale', amdaPlotObj.PlotObjectConfig.availableAxisScales));
if (this.showColorOption)
axisItems.push(this.addStandardColor('axis-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors));
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));
axisItems.push(this.addStandardFieldSet('Legend', 'axis-legend-activated', legendItems));
if (this.showTickGridOptions)
axisItems.push(this.addStandardFieldSet('Ticks and Grid', '', tickGridItems));
return axisItems;
}
});