/** * Project  : TMA-AMDA * Name : PlotHistogram2DSerieForm.js * @class amdaPlotComp.PlotHistogram2DSerieForm * @extends amdaPlotComp.PlotBaseSerieForm * @brief Form to define specifics histogram2d serie options * @author Furkan Erdogan * @version $Id: PlotHistogram2DSerieForm.js furkan $ */ Ext.define('amdaPlotComp.PlotHistogram2DSerieForm', { extend: 'amdaPlotComp.PlotBaseSerieForm', setObject: function (object) { this.callParent(arguments); this.updateOptions(this.object.get('histo2d-function')); }, setParentObject: function (parentObject) { this.callParent(arguments); this.updateAxesRangesAndColourMap(parentObject); }, updateOptions: function(functionType) { var isDensity = (functionType == 'density') || (functionType == 'normdensity'); var zParamField = this.getForm().findField('histotype-param'); zParamField.setVisible(!isDensity) }, updateAxesRangesAndColourMap: function(parentObject) { var xAxisObj = parentObject.axes().getById('xaxis_id'); var yAxisObj = parentObject.axes().getById('y-left'); var colorAxisObj = parentObject.axes().getById('color'); this.getForm().findField('histo2d-xmin').setValue(xAxisObj.get('axis-range-min')); this.getForm().findField('histo2d-xmax').setValue(xAxisObj.get('axis-range-max')); this.getForm().findField('histo2d-ymin').setValue(yAxisObj.get('axis-range-min')); this.getForm().findField('histo2d-ymax').setValue(yAxisObj.get('axis-range-max')); this.getForm().findField('histo2d-color-map').setValue(colorAxisObj.get('axis-color-map')); }, getRangeForms: function(){ var me = this; return { xtype: 'fieldset', bodyStyle: { background: '#dfe8f6' }, title: 'X & Y ranges', name: 'histo2d-ranges', renderTo: Ext.getBody(), fieldDefaults: { labelAlign: 'right', msgTarget: 'side', labelWidth: 40, }, defaults: { xtype: 'panel', bodyStyle: {background: '#dfe8f6'}, flex: 1, border:false, layout: 'anchor', }, layout:'hbox', frame: true, //bodyPadding: '5 5 5 5', items: [{ items:[ me.addStandardFloat2('histo2d-xmin', 'X Min', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){ me.parentObject.axes().getById('xaxis_id').set('axis-range-min', newValue); }), me.addStandardFloat2('histo2d-xmax', 'X Max', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){ me.parentObject.axes().getById('xaxis_id').set('axis-range-max', newValue); }), ] }, { items:[ me.addStandardFloat2('histo2d-ymin', 'Y Min', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){ me.parentObject.axes().getById('y-left').set('axis-range-min', newValue); }), me.addStandardFloat2('histo2d-ymax', 'Y Max', -Number.MAX_VALUE, Number.MAX_VALUE, false, false, function(name, newValue, oldValue){ me.parentObject.axes().getById('y-left').set('axis-range-max', newValue); }), ], }] }; }, getFormItems: function() { var me = this; var histogram2DItems = [ this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter', function(name, value, oldValue) { me.object.set('serie-xaxis-param', value); me.crtTree.refresh(); }), me.getRangeForms(), this.addStandardCombo('serie-resampling-mode', 'Reference parameter for resampling', amdaDefaultConfigs.availableResamplingModes), this.addStandardCombo('histo2d-function', 'Function to apply', amdaDefaultConfigs.availableHistogram2DFunctions, function(name, value, oldValue) { me.object.set('histo2d-function', value); me.updateOptions(value); }), this.addStandardParamDropTarget('histotype-param', 'Z Parameter', function(name, value, oldValue) { me.object.set('histotype-param', value); me.crtTree.refresh(); }), this.addStandardInteger('histo2d-xbinnumber', 'X - Nb. of bins'), this.addStandardInteger('histo2d-ybinnumber', 'Y - Nb. of bins'), this.addStandardInteger('histo2d-smoothfactor', 'Smooth factor'), this.addColorMapCombo('histo2d-color-map', function(name, newValue, oldValue){ me.parentObject.axes().getById('color').set('axis-color-map', newValue); }) ]; return histogram2DItems; } });