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 57 /**
58 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 61 let config = {
62 62 id: 'plot-zoom-win-' + this.hostCmp.ownerCt.getId(),
63 63 interactiveId: interactiveId,
64 64 panelId: panelId,
  65 + panelContext: panelContext,
65 66 hostCmp: this.hostCmp,
66 67 renderTo: this.hostCmp.ownerCt.body,
67 68 listeners: {
... ...
js/app/views/PlotComponents/intervalSelection/PlotFunctionIntervalSelection.js
... ... @@ -11,7 +11,10 @@ Ext.define('amdaPlotComp.intervalSelection.PlotFunctionIntervalSelection', {
11 11 */
12 12 initComponent: function () {
13 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 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 97 this.currentModule = Ext.create('amdaPlotComp.plotFunction.FFTCmpt', { title: "DFT Arguments" });
98 98 break;
99 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 110 break;
102 111 default:
103 112 break;
... ...
js/app/views/PlotComponents/plotFunction/Histogram.js
... ... @@ -14,7 +14,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
14 14 */
15 15 initComponent: function () {
16 16 const self = this;
17   -
  17 +
18 18 // Define combo box store
19 19 const comboStore = Ext.create('Ext.data.Store', {
20 20 fields: ['label', 'value'],
... ... @@ -46,6 +46,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
46 46 allowDecimals: true,
47 47 hideTrigger: true,
48 48 keyNavEnabled: false,
  49 + value: self.xmin,
49 50 },
50 51 {
51 52 xtype: 'numberfield',
... ... @@ -54,6 +55,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
54 55 allowDecimals: true,
55 56 hideTrigger: true,
56 57 keyNavEnabled: false,
  58 + value: self.xmax,
57 59 },
58 60 {
59 61 xtype: 'numberfield',
... ...
js/app/views/PlotTabResultUI.js
... ... @@ -153,7 +153,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
153 153 me.contextualMenu.add({
154 154 text: 'Zoom on Time Axis',
155 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 157 zoomPlugin.resetMinMaxValue();
158 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 163 plotFunctionItem = {
164 164 text: 'Apply a Function on Interval',
165 165 handler: function (item, e) {
166   - zoomPlugin.show(me.interactiveId, "plotFunction", panelContext.id);
  166 + zoomPlugin.show(me.interactiveId, "plotFunction", panelContext.id, panelContext);
167 167 zoomPlugin.resetMinMaxValue();
168 168 me.panelImage.startZoom(true, 0, size.height, onMinTimeSelection, onMaxTimeSelection);
169 169 },
... ... @@ -172,7 +172,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
172 172 insertIntervalItem = {
173 173 text: 'Insert Interval in TimeTable or Catalog',
174 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 176 zoomPlugin.resetMinMaxValue();
177 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 183 me.contextualMenu.add({
184 184 text: 'Zoom on Y Left Axis',
185 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 187 zoomPlugin.resetMinMaxValue();
188 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 193 me.contextualMenu.add({
194 194 text: 'Zoom on Y Right Axis',
195 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 197 zoomPlugin.resetMinMaxValue();
198 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 203 me.contextualMenu.add({
204 204 text: 'Zoom on X Axis',
205 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 207 zoomPlugin.resetMinMaxValue();
208 208 me.panelImage.startZoom(true, me.toPixelOnResultImage(panelContext.y), me.toPixelOnResultImage(panelContext.height), onMinXValueSelection, onMaxXValueSelection);
209 209 }
... ...