Commit d7edb1cf451c337741cd6e878a33cd807c08f2e3

Authored by Benjamin Renard
2 parents 278185de 42e982bf

Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM

js/app/models/PlotObjects/PlotAxisObject.js
... ... @@ -26,32 +26,38 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
26 26 //axis-type can be : time, y-left, y-right, x, color, epoch
27 27 {name: 'axis-type', type: 'string'},
28 28 {name: 'axis-reverse', type: 'boolean'},
29   - {name: 'axis-scale', type: 'string'},
  29 + {name: 'axis-scale', type: 'string'},
30 30 {name: 'axis-range-min', type: 'float'},
31 31 {name: 'axis-range-max', type: 'float'},
32 32 {name: 'axis-range-extend', type: 'boolean'},
33 33 {name: 'axis-color', type: 'string'},
34 34 {name: 'axis-thickness', type: 'int'},
35 35 {name: 'axis-tick-showmarks', type: 'boolean'},
  36 + {name: 'axis-grid-specify-ticks-number', type: 'boolean'},
  37 + {name: 'axis-grid-specify-ticks-spacing', type: 'boolean'},
36 38 {name: 'axis-tick-position', type: 'string'},
37 39 {name: 'axis-grid-minor', type: 'boolean'},
38 40 {name: 'axis-grid-major', type: 'boolean'},
  41 + {name:'axis-grid-minor-number',type:'int'},
  42 + {name:'axis-grid-major-number',type:'int'},
  43 + {name:'axis-grid-major-space',type:'float'},
  44 + {name:'axis-grid-minor-space',type:'float'},
39 45 {name: 'axis-legend-activated', type: 'boolean'},
40 46 {name: 'axis-legend-text', type: 'string'},
41 47 {name: 'axis-legend-color', type: 'string'},
42   - {name: 'axis-legend-font-activated', type: 'boolean'},
43   - {name: 'axis-legend-font-name', type: 'string'},
44   - {name: 'axis-legend-font-size', type: 'int'},
45   - {name: 'axis-legend-font-bold', type: 'boolean'},
46   - {name: 'axis-legend-font-italic', type: 'boolean'},
47   - //only used for time axis
48   - {name: 'axis-time-format', type: 'string'},
49   - //only used for epoch axis
50   - {name: 'axis-epoch-normalized', type: 'boolean'},
51   - //only used for color axis
52   - {name: 'axis-color-map', type: 'string'},
53   - {name: 'axis-color-minval', type: 'string'},
54   - {name: 'axis-color-maxval', type: 'string'}
  48 + {name: 'axis-legend-font-activated', type: 'boolean'},
  49 + {name: 'axis-legend-font-name', type: 'string'},
  50 + {name: 'axis-legend-font-size', type: 'int'},
  51 + {name: 'axis-legend-font-bold', type: 'boolean'},
  52 + {name: 'axis-legend-font-italic', type: 'boolean'},
  53 + //only used for time axis
  54 + {name: 'axis-time-format', type: 'string'},
  55 + //only used for epoch axis
  56 + {name: 'axis-epoch-normalized', type: 'boolean'},
  57 + //only used for color axis
  58 + {name: 'axis-color-map', type: 'string'},
  59 + {name: 'axis-color-minval', type: 'string'},
  60 + {name: 'axis-color-maxval', type: 'string'}
55 61 ],
56 62  
57 63 associations : [
... ... @@ -89,7 +95,13 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
89 95 this.set('axis-thickness', amdaPlotObj.PlotObjectConfig.defaultValues.axis.thickness);
90 96 this.set('axis-tick-showmarks', true);
91 97 this.set('axis-tick-position', amdaPlotObj.PlotObjectConfig.defaultValues.axis.tickPosition);
  98 + this.set('axis-grid-minor-number',1);
  99 + this.set('axis-grid-major-number',1);
  100 + this.set('axis-grid-minor-space',0);
  101 + this.set('axis-grid-major-space',0);
92 102 this.set('axis-grid-minor', false);
  103 + this.set('axis-grid-specify-ticks-number', false);
  104 + this.set('axis-grid-specify-ticks-spacing', false);
93 105 this.set('axis-grid-major', false);
94 106 this.set('axis-legend-activated', true);
95 107 this.set('axis-legend-text', '');
... ... @@ -128,6 +140,12 @@ Ext.define('amdaPlotObj.PlotAxisObject', {
128 140 axisValues['axis-tick-position'] = this.get('axis-tick-position');
129 141 axisValues['axis-grid-minor'] = this.get('axis-grid-minor');
130 142 axisValues['axis-grid-major'] = this.get('axis-grid-major');
  143 + axisValues['axis-grid-minor-number']=this.get('axis-grid-minor-number');
  144 + axisValues['axis-grid-major-number']=this.get('axis-grid-major-number');
  145 + axisValues['axis-grid-specify-ticks-number']=this.get('axis-grid-specify-ticks-number');
  146 + axisValues['axis-grid-minor-space']=this.get('axis-grid-minor-space');
  147 + axisValues['axis-grid-major-space']=this.get('axis-grid-major-space');
  148 + axisValues['axis-grid-specify-ticks-spacing']=this.get('axis-grid-specify-ticks-spacing');
131 149 axisValues['axis-legend-activated'] = this.get('axis-legend-activated');
132 150 axisValues['axis-legend-text'] = this.get('axis-legend-text');
133 151 axisValues['axis-legend-color'] = this.get('axis-legend-color');
... ...
js/app/views/PlotComponents/PlotBaseAxisForm.js
... ... @@ -15,8 +15,10 @@ Ext.define('amdaPlotComp.PlotBaseAxisForm', {
15 15 showColorOption : true,
16 16 showRangeOptions : true,
17 17 showTickGridOptions : true,
  18 + showTicksNumberSpacing : true,
18 19  
19 20 getFormItems: function() {
  21 + var me = this;
20 22 var rangeItems = [
21 23 this.addStandardFloat2('axis-range-min', 'Min', -Number.MAX_VALUE, Number.MAX_VALUE),
22 24 this.addStandardFloat2('axis-range-max', 'Max', -Number.MAX_VALUE, Number.MAX_VALUE),
... ... @@ -28,14 +30,38 @@ Ext.define('amdaPlotComp.PlotBaseAxisForm', {
28 30 this.addStandardColor('axis-legend-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors),
29 31 this.addStandardFont('axis-legend-font')
30 32 ];
31   -
  33 + var manageTicksNumber = function (name, newValue, oldValue){
  34 + me.getForm( ).findField('axis-grid-minor-number').setDisabled( !newValue);
  35 + me.getForm( ).findField('axis-grid-major-number').setDisabled( !newValue);
  36 + if( newValue){
  37 + me.getForm( ).findField('axis-grid-minor-space').setDisabled(newValue);
  38 + me.getForm( ).findField('axis-grid-major-space').setDisabled(newValue);
  39 + me.getForm( ).findField('axis-grid-specify-ticks-spacing').setValue(!newValue);
  40 + }
  41 + };
  42 + var manageTicksSpacing = function (name, newValue, oldValue){
  43 + me.getForm( ).findField('axis-grid-minor-space').setDisabled( !newValue );
  44 + me.getForm( ).findField('axis-grid-major-space').setDisabled( !newValue );
  45 + if( newValue ){
  46 + me.getForm( ).findField('axis-grid-minor-number').setDisabled(newValue);
  47 + me.getForm( ).findField('axis-grid-major-number').setDisabled(newValue);
  48 + me.getForm( ).findField('axis-grid-specify-ticks-number').setValue(!newValue);
  49 + }
  50 + };
32 51 var tickGridItems = [
33 52 this.addStandardCombo('axis-tick-position', 'Ticks position', amdaPlotObj.PlotObjectConfig.availableTicksPositions),
34 53 this.addStandardCheck('axis-tick-showmarks', 'Show tick marks'),
35 54 this.addStandardCheck('axis-grid-major', 'Show major grid'),
36   - this.addStandardCheck('axis-grid-minor', 'Show minor grid')
37   - ];
38   -
  55 + this.addStandardCheck('axis-grid-minor', 'Show minor grid')];
  56 + if (this.showTicksNumberSpacing){
  57 + tickGridItems.push(this.addStandardCheck('axis-grid-specify-ticks-number', 'Specify ticks number', manageTicksNumber));
  58 + tickGridItems.push(this.addStandardInteger('axis-grid-major-number', 'Nb of Major Ticks', 1, Number.MAX_VALUE,true,true));
  59 + tickGridItems.push(this.addStandardInteger('axis-grid-minor-number', 'Nb of Minor Ticks', 1, Number.MAX_VALUE,true,true));
  60 + tickGridItems.push(this.addStandardCheck('axis-grid-specify-ticks-spacing', 'Specify ticks spacing',manageTicksSpacing));
  61 + tickGridItems.push(this.addStandardFloat2('axis-grid-major-space', ' Major Ticks Space', 0, Number.MAX_VALUE,true,true));
  62 + tickGridItems.push(this.addStandardFloat2('axis-grid-minor-space', ' Minor Ticks Space', 0, Number.MAX_VALUE,true,true));
  63 + };
  64 +
39 65 var axisItems = [];
40 66 if (this.showScaleOption)
41 67 axisItems.push(this.addStandardCombo('axis-scale', 'Scale', amdaPlotObj.PlotObjectConfig.availableAxisScales));
... ...
js/app/views/PlotComponents/PlotEpochAxisForm.js
... ... @@ -13,6 +13,7 @@ Ext.define('amdaPlotComp.PlotEpochAxisForm', {
13 13  
14 14 showScaleOption : false,
15 15 showRangeOptions : false,
  16 + showTicksNumberSpacing : false,
16 17  
17 18 getFormItems: function() {
18 19 var epochItems = [
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -21,6 +21,8 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
21 21  
22 22 //Link to the tree
23 23 crtTree: null,
  24 + desableTickNumber:true,
  25 + desableTickSpacing:true,
24 26  
25 27 constructor: function(config) {
26 28 this.init(config);
... ... @@ -81,15 +83,41 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
81 83 }
82 84 };
83 85 },
  86 + addStandardInteger: function(name, label, min, max, allowBlank, disabled,onChange) {
  87 + allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false;
  88 +
  89 + return {
  90 + id:name,
  91 + xtype: 'numberfield',
  92 + name: name,
  93 + fieldLabel: label,
  94 + disabled:(disabled)? true:false,
  95 + regex:/^\d+$/,
  96 + decimalPrecision : 20,
  97 + minValue : min,
  98 + maxValue : max,
  99 + allowBlank : allowBlank,
  100 + listeners: {
  101 + change: function(field, newValue, oldValue, eOpts) {
  102 + this.object.set(name, newValue);
  103 + if (onChange != null)
  104 + onChange(name, newValue, oldValue);
  105 + },
  106 + scope: this
  107 + }
  108 + };
  109 + },
84 110  
85   - addStandardFloat2: function(name, label, min, max, allowBlank, onChange) {
  111 + addStandardFloat2: function(name, label, min, max, allowBlank, disabled, onChange) {
86 112 allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false;
87 113  
88 114 return {
  115 + id:name,
89 116 xtype: 'textfield',
90 117 name: name,
91 118 fieldLabel: label,
92 119 regex : /[-+]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][-+]?\d+)?/,
  120 + disabled:(disabled)? true:false,
93 121 validator: function (val) {
94 122 var errMsg = null;
95 123 if (!allowBlank && Ext.isEmpty(val)) {
... ... @@ -148,6 +176,7 @@ Ext.define('amdaPlotComp.PlotStandardForm', {
148 176 boxLabel: label,
149 177 listeners: {
150 178 change: function(combo, newValue, oldValue, eOpts) {
  179 +
151 180 this.object.set(name, newValue);
152 181 if (onChange != null)
153 182 onChange(name, newValue, oldValue);
... ...
js/app/views/PlotComponents/PlotTimeAxisForm.js
... ... @@ -13,6 +13,7 @@ Ext.define('amdaPlotComp.PlotTimeAxisForm', {
13 13  
14 14 showScaleOption : false,
15 15 showRangeOptions : false,
  16 + showTicksNumberSpacing : false,
16 17  
17 18 getFormItems: function() {
18 19 var timeItems = [
... ...