Commit 6e83f9b99a9778a9f9c0a62a4a2aaa945ca5e32c

Authored by Erdogan Furkan
1 parent 1cfbb4ac

Done

js/app/models/PlotObjects/PlotHistogram2DSerieObject.js 0 → 100644
... ... @@ -0,0 +1,69 @@
  1 +/**
  2 + * Project  : TMA-AMDA
  3 + * Name : PlotHistogram2DSerieObject.js
  4 + * @class amdaPlotObj.PlotHistogram2DSerieObject
  5 + * @extends amdaPlotObj.PlotBaseSerieObject
  6 + * @brief Plot Histogram2D Business Object Definition
  7 + * @author Furkan Erdogan
  8 + * @version $Id: PlotHistogram2DSerieObject.js furkan $
  9 + ******************************************************************************
  10 + * FT Id : Date : Name - Description
  11 + ******************************************************************************
  12 + * : :08/02/2023: FER - file creation
  13 + */
  14 +
  15 +
  16 +Ext.define('amdaPlotObj.PlotHistogram2DSerieObject', {
  17 + extend: 'amdaPlotObj.PlotBaseSerieObject',
  18 + requires: ['amdaPlotObj.PlotAxisObject'],
  19 + fields : [
  20 + {name: 'serie-xaxis-param', type: 'string'},
  21 + {name: 'histo2d-xmin', type:'float', useNull:true},
  22 + {name: 'histo2d-xmax', type:'float', useNull:true},
  23 + {name: 'histo2d-ymin', type:'float', useNull:true},
  24 + {name: 'histo2d-ymax', type:'float', useNull:true},
  25 + {name: 'serie-resampling-mode', type: 'string'},
  26 + {name: 'histo2d-function', type: 'string'},
  27 + {name: 'histotype-param', type: 'string' },
  28 + {name: 'histo2d-xbinnumber', type: 'int'},
  29 + {name: 'histo2d-ybinnumber', type: 'int'},
  30 + {name: 'histo2d-smoothfactor', type: 'int'}
  31 +
  32 + ],
  33 +
  34 + constructor: function(){
  35 + var me = this;
  36 + me.callParent(arguments);
  37 + },
  38 +
  39 + setDefaultValues: function()
  40 + {
  41 + this.set('serie-xaxis-param', '');
  42 + this.set('serie-resampling-mode', amdaPlotObj.PlotObjectConfig.defaultValues.serie.resamplingMode);
  43 + this.set('histo2d-function', '');
  44 + this.set('histotype-param', '');
  45 + this.set('histo2d-xbinnumber', amdaPlotObj.PlotObjectConfig.defaultValues.histogram2D.xbinnumber);
  46 + this.set('histo2d-ybinnumber', amdaPlotObj.PlotObjectConfig.defaultValues.histogram2D.ybinnumber);
  47 + this.set('histo2d-smoothfactor', amdaPlotObj.PlotObjectConfig.defaultValues.histogram2D.smoothfactor)
  48 +
  49 + this.callParent(arguments);
  50 + },
  51 +
  52 + getJsonValues : function()
  53 + {
  54 + var serieValues = this.callParent(arguments);
  55 + serieValues['serie-xaxis-param'] = this.get('serie-xaxis-param');
  56 + serieValues['histo2d-xmin'] = this.get('histo2d-xmin');
  57 + serieValues['histo2d-xmax'] = this.get('histo2d-xmax');
  58 + serieValues['histo2d-ymin'] = this.get('histo2d-ymin');
  59 + serieValues['histo2d-ymax'] = this.get('histo2d-ymax');
  60 + serieValues['serie-resampling-mode'] = this.get('serie-resampling-mode');
  61 + serieValues['histo2d-function'] = this.get('histo2d-function');
  62 + serieValues['histotype-param'] = this.get('histotype-param');
  63 + serieValues['histo2d-xbinnumber'] = this.get('histo2d-xbinnumber');
  64 + serieValues['histo2d-ybinnumber'] = this.get('histo2d-ybinnumber');
  65 + serieValues['histo2d-smoothfactor'] = this.get('histo2d-smoothfactor');
  66 +
  67 + return serieValues;
  68 + }
  69 +});
0 70 \ No newline at end of file
... ...
js/app/models/PlotObjects/PlotObjectConfig.js
... ... @@ -143,6 +143,12 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
143 143 yAxis: 'y-left',
144 144 resolution: 3000
145 145 },
  146 + histogram2D:{
  147 + histo2DFunction: 'density',
  148 + xbinnumber: 100,
  149 + ybinnumber: 100,
  150 + smoothfactor: 1,
  151 + },
146 152 sauvaud: {
147 153 yAxis: 'y-right',
148 154 resolution: 3000
... ... @@ -444,6 +450,15 @@ Ext.define('amdaPlotObj.PlotObjectConfig', {
444 450 { 'key': 'ZR', 'value': 'ZR' }
445 451 ],
446 452  
  453 + availableHistogram2DFunctions: [
  454 + { 'key': 'density', 'value': 'Density' },
  455 + { 'key': 'mean', 'value': 'Mean' },
  456 + { 'key': 'min', 'value': 'Minimum' },
  457 + { 'key': 'max', 'value': 'Maximum' },
  458 + { 'key': 'median', 'value': 'Median' },
  459 + { 'key': 'stadev', 'value': 'Standard Deviation' }
  460 + ],
  461 +
447 462 availableDimsOnXAxis: [
448 463 { 'key': '0', 'value': 'First dimension' },
449 464 { 'key': '1', 'value': 'Second dimension' }
... ...
js/app/models/PlotObjects/PlotParamObject.js
... ... @@ -20,6 +20,7 @@ Ext.define('amdaPlotObj.PlotParamObject', {
20 20 'amdaPlotObj.PlotObjectConfig',
21 21 'amdaPlotObj.PlotSerieObject',
22 22 'amdaPlotObj.PlotOrbitSerieObject',
  23 + 'amdaPlotObj.PlotHistogram2DSerieObject',
23 24 'amdaPlotObj.PlotSpectroObject',
24 25 'amdaPlotObj.PlotSauvaudObject',
25 26 'amdaPlotObj.PlotStatusBarObject',
... ... @@ -72,8 +73,10 @@ Ext.define('amdaPlotObj.PlotParamObject', {
72 73 {
73 74 case 'serie' :
74 75 return new amdaPlotObj.PlotSerieObject(data);
75   - case 'orbit-serie' :
76   - return new amdaPlotObj.PlotOrbitSerieObject(data);
  76 + case 'histogram2d' :
  77 + return new amdaPlotObj.PlotHistogram2DSerieObject(data);
  78 + case 'orbit-serie' :
  79 + return new amdaPlotObj.PlotOrbitSerieObject(data);
77 80 case 'spectro' :
78 81 return new amdaPlotObj.PlotSpectroObject(data);
79 82 case 'status-bar' :
... ... @@ -129,7 +132,8 @@ Ext.define('amdaPlotObj.PlotParamObject', {
129 132 case 'xyPlot' :
130 133 return [
131 134 {'key' : 'serie', 'value' : 'Serie'},
132   - {'key' : 'orbit-serie', 'value' : 'Orbit Serie'}
  135 + {'key' : 'orbit-serie', 'value' : 'Orbit Serie'},
  136 + {'key' : 'histogram2d', 'value' : '2D Histogram'}
133 137 ];
134 138 case 'instantPlot' :
135 139 return [
... ...
js/app/views/PlotComponents/PlotBaseSerieForm.js
... ... @@ -21,29 +21,31 @@ Ext.define('amdaPlotComp.PlotBaseSerieForm', {
21 21 var isScatter = (plotType == 'xyPlot');
22 22  
23 23 var timeTickTypeField = this.getForm().findField('serie-timetick-type');
24   - var timeTickFieldSet = timeTickTypeField.findParentByType('fieldset');
  24 + if (timeTickTypeField != null){
  25 + var timeTickFieldSet = timeTickTypeField.findParentByType('fieldset');
25 26  
26   - timeTickFieldSet.setVisible(isScatter);
27   -
28   - if (isScatter)
29   - {
30   - //Update Time Tick field
31   - var timeTickStepField = this.getForm().findField('serie-timetick-step');
32   - var timeTickNbMajorField = this.getForm().findField('serie-timetick-nbmajor');
33   - switch (timeTickTypeField.getValue())
  27 + timeTickFieldSet.setVisible(isScatter);
  28 +
  29 + if (isScatter)
34 30 {
35   - case 'time-step' :
36   - timeTickStepField.setVisible(true);
37   - timeTickNbMajorField.setVisible(false);
38   - break;
39   - case 'nb-major' :
40   - timeTickStepField.setVisible(false);
41   - timeTickNbMajorField.setVisible(true);
42   - break;
43   - case 'auto' :
44   - default :
45   - timeTickStepField.setVisible(false);
46   - timeTickNbMajorField.setVisible(false);
  31 + //Update Time Tick field
  32 + var timeTickStepField = this.getForm().findField('serie-timetick-step');
  33 + var timeTickNbMajorField = this.getForm().findField('serie-timetick-nbmajor');
  34 + switch (timeTickTypeField.getValue())
  35 + {
  36 + case 'time-step' :
  37 + timeTickStepField.setVisible(true);
  38 + timeTickNbMajorField.setVisible(false);
  39 + break;
  40 + case 'nb-major' :
  41 + timeTickStepField.setVisible(false);
  42 + timeTickNbMajorField.setVisible(true);
  43 + break;
  44 + case 'auto' :
  45 + default :
  46 + timeTickStepField.setVisible(false);
  47 + timeTickNbMajorField.setVisible(false);
  48 + }
47 49 }
48 50 }
49 51 },
... ...
js/app/views/PlotComponents/PlotHistogram2DSerieForm.js 0 → 100644
... ... @@ -0,0 +1,85 @@
  1 +/**
  2 + * Project  : TMA-AMDA
  3 + * Name : PlotHistogram2DSerieForm.js
  4 + * @class amdaPlotComp.PlotHistogram2DSerieForm
  5 + * @extends amdaPlotComp.PlotBaseSerieForm
  6 + * @brief Form to define specifics histogram2d serie options
  7 + * @author Furkan Erdogan
  8 + * @version $Id: PlotHistogram2DSerieForm.js furkan $
  9 + */
  10 +
  11 +Ext.define('amdaPlotComp.PlotHistogram2DSerieForm', {
  12 + extend: 'amdaPlotComp.PlotBaseSerieForm',
  13 +
  14 + updateOptions: function(functionType) {
  15 + var isDensity = (functionType == 'density');
  16 +
  17 + var zParamField = this.getForm().findField('histotype-param');
  18 + zParamField.setVisible(!isDensity)
  19 + },
  20 + getRangeForms: function(){
  21 + var me = this;
  22 + return {
  23 + xtype: 'fieldset',
  24 + bodyStyle: { background: '#dfe8f6' },
  25 + title: 'X & Y ranges',
  26 + name: 'histo2d-ranges',
  27 + renderTo: Ext.getBody(),
  28 + fieldDefaults: {
  29 + labelAlign: 'right',
  30 + msgTarget: 'side',
  31 + labelWidth: 40,
  32 + },
  33 + defaults: {
  34 + xtype: 'panel',
  35 + bodyStyle: {background: '#dfe8f6'},
  36 + flex: 1,
  37 + border:false,
  38 + layout: 'anchor',
  39 + },
  40 + layout:'hbox',
  41 + frame: true,
  42 + //bodyPadding: '5 5 5 5',
  43 + items:
  44 + [{
  45 + items:[
  46 + me.addStandardFloat2('histo2d-xmin', 'X Min'),
  47 + me.addStandardFloat2('histo2d-xmax', 'X Max'),
  48 + ]
  49 + },
  50 + {
  51 + items:[
  52 + me.addStandardFloat2('histo2d-ymin', 'Y Min'),
  53 + me.addStandardFloat2('histo2d-ymax', 'Y Max'),
  54 + ],
  55 + }]
  56 + };
  57 +
  58 + },
  59 + getFormItems: function() {
  60 + var me = this;
  61 +
  62 +
  63 + var histogram2DItems = [
  64 + this.addStandardParamDropTarget('serie-xaxis-param', 'X Parameter', function(name, value, oldValue) {
  65 + me.object.set('serie-xaxis-param', value);
  66 + me.crtTree.refresh();
  67 + }),
  68 + me.getRangeForms(),
  69 + this.addStandardCombo('serie-resampling-mode', 'Reference parameter for resampling', amdaPlotObj.PlotObjectConfig.availableResamplingModes),
  70 + this.addStandardCombo('histo2d-function', 'Function to apply', amdaPlotObj.PlotObjectConfig.availableHistogram2DFunctions, function(name, value, oldValue) {
  71 + me.object.set('histo2d-function', value);
  72 + me.updateOptions(value);
  73 + }),
  74 + this.addStandardParamDropTarget('histotype-param', 'Z Parameter', function(name, value, oldValue) {
  75 + me.object.set('histotype-param', value);
  76 + me.crtTree.refresh();
  77 + }),
  78 + this.addStandardInteger('histo2d-xbinnumber', 'X - Nb. of bins'),
  79 + this.addStandardInteger('histo2d-ybinnumber', 'Y - Nb. of bins'),
  80 + this.addStandardInteger('histo2d-smoothfactor', 'Smooth factor')
  81 +
  82 + ];
  83 + return histogram2DItems;
  84 + }
  85 +});
0 86 \ No newline at end of file
... ...
js/app/views/PlotComponents/PlotParamForm.js
... ... @@ -14,6 +14,7 @@ Ext.define('amdaPlotComp.PlotParamForm', {
14 14 requires: [
15 15 'amdaPlotComp.PlotSerieForm',
16 16 'amdaPlotComp.PlotOrbitSerieForm',
  17 + 'amdaPlotComp.PlotHistogram2DSerieForm',
17 18 'amdaPlotComp.PlotSpectroForm',
18 19 'amdaPlotComp.PlotSauvaudForm',
19 20 'amdaPlotComp.PlotStatusBarForm',
... ... @@ -63,6 +64,9 @@ Ext.define('amdaPlotComp.PlotParamForm', {
63 64 case 'orbit-serie':
64 65 this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotOrbitSerieForm({ id: formId }));
65 66 break;
  67 + case 'histogram2d':
  68 + this.drawingOptionsFormsManager.register(new amdaPlotComp.PlotHistogram2DSerieForm({ id: formId }));
  69 + break;
66 70 case 'sauvaud':
67 71 if(this.object.get('type') !=2){
68 72 myDesktopApp.warningMsg('Sauvaud Plot requires <b>2D Parameter</b> ');
... ...
js/app/views/PlotComponents/PlotStandardForm.js
... ... @@ -109,7 +109,7 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
109 109 },
110 110  
111 111 addStandardFloat2: function (name, label, min, max, allowBlank, hidden, onChange) {
112   - allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false;
  112 + allowBlank = (typeof allowBlank !== 'undefined' || allowBlank == null) ? allowBlank : false;
113 113  
114 114 return {
115 115 xtype: 'textfield',
... ... @@ -122,10 +122,10 @@ Ext.define(&#39;amdaPlotComp.PlotStandardForm&#39;, {
122 122 if (!allowBlank && Ext.isEmpty(val)) {
123 123 errMsg = 'Blank value not allowed';
124 124 }
125   - else if ((typeof min !== 'undefined') && (parseFloat(val) < min)) {
  125 + else if ((typeof min !== 'undefined' && min !== null) && (parseFloat(val) < min)) {
126 126 errMsg = 'Min. allowed value is ' + min;
127 127 }
128   - else if ((typeof max !== 'undefined') && (parseFloat(val) > max)) {
  128 + else if ((typeof max !== 'undefined' && max !== null) && (parseFloat(val) > max)) {
129 129 errMsg = 'Max. allowed value is ' + max;
130 130 }
131 131  
... ...