diff --git a/generic_data/defaultValues.json b/generic_data/defaultValues.json index f213d51..13d284f 100644 --- a/generic_data/defaultValues.json +++ b/generic_data/defaultValues.json @@ -52,6 +52,7 @@ "axis":{ "scale":"linear", "tickPosition":"outwards", + "tickTimeUnit":"default", "color":"#000000", "thickness":1, "legend":{ diff --git a/generic_data/defaultValuesConfig.json b/generic_data/defaultValuesConfig.json index 6b56b78..49aa4c6 100644 --- a/generic_data/defaultValuesConfig.json +++ b/generic_data/defaultValuesConfig.json @@ -69,6 +69,13 @@ { "key": "outwards", "value": "Outwards" } ], + "availableTicksTimeUnits": [ + { "key": "default", "value": "Second(s)" }, + { "key": "min", "value": "Minute(s)" }, + { "key": "hour", "value": "Hour(s)" }, + { "key": "day", "value": "Days(s)" } + ], + "availableTimeAxisFormats": [ { "key": "dd/mm/yy", "value": "dd/mm/yy" }, { "key": "ddd/yy", "value": "ddd/yy" }, diff --git a/generic_data/defaultValuesLinks.json b/generic_data/defaultValuesLinks.json index aa67bcf..0b12635 100644 --- a/generic_data/defaultValuesLinks.json +++ b/generic_data/defaultValuesLinks.json @@ -96,6 +96,11 @@ "type":"combobox", "store":"availableTicksPositions" }, + "plot.axis.tickTimeUnit": + { + "type":"combobox", + "store":"availableTicksTimeUnits" + }, "plot.axis.timeFormat": { "type":"combobox", diff --git a/js/app/models/PlotObjects/PlotAxisObject.js b/js/app/models/PlotObjects/PlotAxisObject.js index 6609512..0fb894c 100644 --- a/js/app/models/PlotObjects/PlotAxisObject.js +++ b/js/app/models/PlotObjects/PlotAxisObject.js @@ -18,42 +18,43 @@ Ext.define('amdaPlotObj.PlotAxisObject', { idProperty: 'id', 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'} + {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-time-unit', type: 'string'}, + {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 : [ @@ -98,6 +99,7 @@ Ext.define('amdaPlotObj.PlotAxisObject', { 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-tick-time-unit',amdaDefaultValues.plot.axis.tickTimeUnit); this.set('axis-grid-major', false); this.set('axis-legend-activated', true); this.set('axis-legend-text', ''); @@ -142,6 +144,7 @@ Ext.define('amdaPlotObj.PlotAxisObject', { 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-tick-time-unit']= this.get('axis-tick-time-unit'); 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'); diff --git a/js/app/views/PlotComponents/PlotBaseAxisForm.js b/js/app/views/PlotComponents/PlotBaseAxisForm.js index a41d04e..7ef6aa2 100644 --- a/js/app/views/PlotComponents/PlotBaseAxisForm.js +++ b/js/app/views/PlotComponents/PlotBaseAxisForm.js @@ -15,9 +15,28 @@ Ext.define('amdaPlotComp.PlotBaseAxisForm', { showColorOption : true, showRangeOptions : true, showTickGridOptions : true, - showTicksNumber: false, - showTicksSpacing:false, + showTicksNumber: false, + showTicksSpacing:false, + showTicksTimeSpacingCombo:false, + 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 ; + + 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 ); + }, + getFormItems: function() { var me = this; var rangeItems = [ @@ -31,36 +50,28 @@ Ext.define('amdaPlotComp.PlotBaseAxisForm', { this.addColorsPicker('axis-legend-color', 'Color', amdaDefaultConfigs.availableColorsNew, 'auto'), 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 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(); + }; var tickGridItems = [ this.addStandardCombo('axis-tick-position', 'Ticks position', amdaDefaultConfigs.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.addStandardCheck('axis-grid-specify-ticks-number', 'Specify ticks number', manageTicksFields)); 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.addStandardCheck('axis-grid-specify-ticks-spacing', 'Specify ticks spacing',manageTicksFields)); + tickGridItems.push(this.addStandardCombo('axis-tick-time-unit', 'Time unit', amdaDefaultConfigs.availableTicksTimeUnits)); 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', amdaDefaultConfigs.availableAxisScales)); diff --git a/js/app/views/PlotComponents/PlotEpochAxisForm.js b/js/app/views/PlotComponents/PlotEpochAxisForm.js index 431d269..611df9c 100644 --- a/js/app/views/PlotComponents/PlotEpochAxisForm.js +++ b/js/app/views/PlotComponents/PlotEpochAxisForm.js @@ -13,7 +13,8 @@ Ext.define('amdaPlotComp.PlotEpochAxisForm', { showScaleOption : false, showRangeOptions : false, - showTicksNumberSpacing : false, + showTicksNumberSpacing : false, + showTicksTimeSpacingCombo :true, getFormItems: function() { var epochItems = [ diff --git a/js/app/views/PlotComponents/PlotTimeAxisForm.js b/js/app/views/PlotComponents/PlotTimeAxisForm.js index 79e4525..2427066 100644 --- a/js/app/views/PlotComponents/PlotTimeAxisForm.js +++ b/js/app/views/PlotComponents/PlotTimeAxisForm.js @@ -13,9 +13,11 @@ Ext.define('amdaPlotComp.PlotTimeAxisForm', { showScaleOption : false, showRangeOptions : false, - showTicksNumberSpacing : false, + showTicksNumberSpacing : false, + showTicksTimeSpacingCombo :true, getFormItems: function() { + var timeItems = [ this.addStandardCombo('axis-time-format', 'Time Format', amdaDefaultConfigs.availableTimeAxisFormats) ]; -- libgit2 0.21.2