Commit bfd39b48b9c490d72852c186c94acf27e5cdea09

Authored by Benjamin Renard
1 parent c855ad54

Interactive histo 1D: set X min/max in relation with the context

js/app/views/PlotComponents/PlotZoomPlug.js
@@ -57,11 +57,12 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { @@ -57,11 +57,12 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
57 /** 57 /**
58 * Function to create and show a window with specific configuration 58 * Function to create and show a window with specific configuration
59 */ 59 */
60 - show: function (interactiveId, zoomType, panelId) { 60 + show: function (interactiveId, zoomType, panelId, panelContext) {
61 let config = { 61 let config = {
62 id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(), 62 id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(),
63 interactiveId: interactiveId, 63 interactiveId: interactiveId,
64 panelId: panelId, 64 panelId: panelId,
  65 + panelContext: panelContext,
65 hostCmp: this.hostCmp, 66 hostCmp: this.hostCmp,
66 renderTo: this.hostCmp.ownerCt.body, 67 renderTo: this.hostCmp.ownerCt.body,
67 listeners: { 68 listeners: {
js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js
@@ -11,7 +11,10 @@ Ext.define('amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection', { @@ -11,7 +11,10 @@ Ext.define('amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection', {
11 */ 11 */
12 initComponent: function () { 12 initComponent: function () {
13 this.callParent(arguments); 13 this.callParent(arguments);
14 - this.plotFunctionType = new amdaPlotComp.plotFunction.FunctionType(); 14 + this.plotFunctionType = Ext.create('amdaPlotComp.plotFunction.FunctionType', {
  15 + panelContext: this.panelContext
  16 + });
  17 +
15 this.form.add(this.plotFunctionType); 18 this.form.add(this.plotFunctionType);
16 }, 19 },
17 20
js/app/views/PlotComponents/plotFunction/FunctionType.js
@@ -97,7 +97,16 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { @@ -97,7 +97,16 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
97 this.currentModule = Ext.create('amdaPlotComp.plotFunction.FFTCmpt', { title: "DFT Arguments" }); 97 this.currentModule = Ext.create('amdaPlotComp.plotFunction.FFTCmpt', { title: "DFT Arguments" });
98 break; 98 break;
99 case this.functionOptions.hist.value: 99 case this.functionOptions.hist.value:
100 - this.currentModule = Ext.create('amdaPlotComp.plotFunction.Histogram'); 100 + var histoConfig = {};
  101 + if (this.panelContext && this.panelContext.plotArea.axes) {
  102 + Ext.Array.each(this.panelContext.plotArea.axes, function(axis) {
  103 + if (axis['id'] == 'y-left') {
  104 + histoConfig['xmin'] = axis['min'];
  105 + histoConfig['xmax'] = axis['max'];
  106 + }
  107 + });
  108 + }
  109 + this.currentModule = Ext.create('amdaPlotComp.plotFunction.Histogram', histoConfig);
101 break; 110 break;
102 default: 111 default:
103 break; 112 break;
js/app/views/PlotComponents/plotFunction/Histogram.js
@@ -14,7 +14,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', { @@ -14,7 +14,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
14 */ 14 */
15 initComponent: function () { 15 initComponent: function () {
16 const self = this; 16 const self = this;
17 - 17 +
18 // Define combo box store 18 // Define combo box store
19 const comboStore = Ext.create('Ext.data.Store', { 19 const comboStore = Ext.create('Ext.data.Store', {
20 fields: ['label', 'value'], 20 fields: ['label', 'value'],
@@ -46,6 +46,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', { @@ -46,6 +46,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
46 allowDecimals: true, 46 allowDecimals: true,
47 hideTrigger: true, 47 hideTrigger: true,
48 keyNavEnabled: false, 48 keyNavEnabled: false,
  49 + value: self.xmin,
49 }, 50 },
50 { 51 {
51 xtype: 'numberfield', 52 xtype: 'numberfield',
@@ -54,6 +55,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', { @@ -54,6 +55,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
54 allowDecimals: true, 55 allowDecimals: true,
55 hideTrigger: true, 56 hideTrigger: true,
56 keyNavEnabled: false, 57 keyNavEnabled: false,
  58 + value: self.xmax,
57 }, 59 },
58 { 60 {
59 xtype: 'numberfield', 61 xtype: 'numberfield',
js/app/views/PlotTabResultUI.js
@@ -153,7 +153,7 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -153,7 +153,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
153 me.contextualMenu.add({ 153 me.contextualMenu.add({
154 text: 'Zoom on Time Axis', 154 text: 'Zoom on Time Axis',
155 handler: function (item, e) { 155 handler: function (item, e) {
156 - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id); 156 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id, panelContext);
157 zoomPlugin.resetMinMaxValue(); 157 zoomPlugin.resetMinMaxValue();
158 me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection); 158 me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection);
159 }, 159 },
@@ -163,7 +163,7 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -163,7 +163,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
163 plotFunctionItem = { 163 plotFunctionItem = {
164 text: 'Apply a Function on Interval', 164 text: 'Apply a Function on Interval',
165 handler: function (item, e) { 165 handler: function (item, e) {
166 - zoomPlugin.show(me.interactiveId, "plotFunction", panelContext.id); 166 + zoomPlugin.show(me.interactiveId, "plotFunction", panelContext.id, panelContext);
167 zoomPlugin.resetMinMaxValue(); 167 zoomPlugin.resetMinMaxValue();
168 me.panelImage.startZoom(true, 0, size.height, onMinTimeSelection, onMaxTimeSelection); 168 me.panelImage.startZoom(true, 0, size.height, onMinTimeSelection, onMaxTimeSelection);
169 }, 169 },
@@ -172,7 +172,7 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -172,7 +172,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
172 insertIntervalItem = { 172 insertIntervalItem = {
173 text: 'Insert Interval in TimeTable or Catalog', 173 text: 'Insert Interval in TimeTable or Catalog',
174 handler: function (item, e) { 174 handler: function (item, e) {
175 - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id); 175 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id, panelContext);
176 zoomPlugin.resetMinMaxValue(); 176 zoomPlugin.resetMinMaxValue();
177 me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection); 177 me.panelImage.startZoom(true, 0/*me.toPixelOnResultImage(panelContext.y)*/, size.height /*me.toPixelOnResultImage(panelContext.height)*/, onMinTimeSelection, onMaxTimeSelection);
178 }, 178 },
@@ -183,7 +183,7 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -183,7 +183,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
183 me.contextualMenu.add({ 183 me.contextualMenu.add({
184 text: 'Zoom on Y Left Axis', 184 text: 'Zoom on Y Left Axis',
185 handler: function (item, e) { 185 handler: function (item, e) {
186 - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id); 186 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id, panelContext);
187 zoomPlugin.resetMinMaxValue(); 187 zoomPlugin.resetMinMaxValue();
188 me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection); 188 me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection);
189 } 189 }
@@ -193,7 +193,7 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -193,7 +193,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
193 me.contextualMenu.add({ 193 me.contextualMenu.add({
194 text: 'Zoom on Y Right Axis', 194 text: 'Zoom on Y Right Axis',
195 handler: function (item, e) { 195 handler: function (item, e) {
196 - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id); 196 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id, panelContext);
197 zoomPlugin.resetMinMaxValue(); 197 zoomPlugin.resetMinMaxValue();
198 me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection); 198 me.panelImage.startZoom(false, me.toPixelOnResultImage(panelContext.x), me.toPixelOnResultImage(panelContext.width), onMinYValueSelection, onMaxYValueSelection);
199 } 199 }
@@ -203,7 +203,7 @@ Ext.define('amdaUI.PlotTabResultUI', { @@ -203,7 +203,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
203 me.contextualMenu.add({ 203 me.contextualMenu.add({
204 text: 'Zoom on X Axis', 204 text: 'Zoom on X Axis',
205 handler: function (item, e) { 205 handler: function (item, e) {
206 - zoomPlugin.show(me.interactiveId, axis.id, panelContext.id); 206 + zoomPlugin.show(me.interactiveId, axis.id, panelContext.id, panelContext);
207 zoomPlugin.resetMinMaxValue(); 207 zoomPlugin.resetMinMaxValue();
208 me.panelImage.startZoom(true, me.toPixelOnResultImage(panelContext.y), me.toPixelOnResultImage(panelContext.height), onMinXValueSelection, onMaxXValueSelection); 208 me.panelImage.startZoom(true, me.toPixelOnResultImage(panelContext.y), me.toPixelOnResultImage(panelContext.height), onMinXValueSelection, onMaxXValueSelection);
209 } 209 }