/** * 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, 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 ; 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 ); } }, 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.addColorsPicker('axis-legend-color', 'Color', amdaDefaultConfigs.availableColorsNew, 'auto'), this.addStandardFont('axis-legend-font') ]; 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', 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',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)); if (this.showColorOption) { axisItems.push(this.addColorsPicker('axis-color', 'Color', amdaDefaultConfigs.availableColorsNew, 'auto')); } 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; } });