Commit bd8d75af507a82ac9abebbf95081ef6b2be48f7a
1 parent
14818a03
Exists in
master
and in
42 other branches
Disable paramter config, minsampling... and Add 'Inherits' axis sacling
Showing
6 changed files
with
384 additions
and
147 deletions
Show diff stats
js/app/controllers/PlotModule.js
... | ... | @@ -9,91 +9,93 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | Ext.define('amdaDesktop.PlotModule', { |
12 | - extend: 'amdaDesktop.InteractiveModule', | |
13 | - | |
14 | - requires: [ | |
15 | - 'amdaUI.PlotUI', | |
16 | - 'amdaPlotObj.MultiplotRequestObject', | |
17 | - 'amdaModel.MultiplotNode', | |
18 | - 'amdaUI.PlotTabResultUI', | |
19 | - 'amdaPlotComp.PlotPreviewUI', | |
20 | - 'amdaUI.MultiPlotUI' | |
21 | - ], | |
22 | - | |
23 | - contentId : 'plotUI', | |
24 | - linkedNode : null, | |
25 | - | |
12 | + extend: 'amdaDesktop.InteractiveModule', | |
13 | + | |
14 | + requires: [ | |
15 | + 'amdaUI.PlotUI', | |
16 | + 'amdaPlotObj.MultiplotRequestObject', | |
17 | + 'amdaModel.MultiplotNode', | |
18 | + 'amdaUI.PlotTabResultUI', | |
19 | + 'amdaPlotComp.PlotPreviewUI', | |
20 | + 'amdaUI.MultiPlotUI' | |
21 | + ], | |
22 | + | |
23 | + contentId: 'plotUI', | |
24 | + linkedNode: null, | |
25 | + | |
26 | 26 | /** |
27 | 27 | * @cfg {String} data models |
28 | 28 | * @required |
29 | 29 | */ |
30 | - nodeDataModel : 'amdaModel.MultiplotNode', | |
31 | - | |
30 | + nodeDataModel: 'amdaModel.MultiplotNode', | |
31 | + | |
32 | 32 | /** |
33 | 33 | * @cfg {String} window definitions |
34 | 34 | * @required |
35 | 35 | */ |
36 | - width: 650, | |
36 | + width: 650, | |
37 | 37 | height: 670, |
38 | - uiType : 'newPanelPlot', | |
39 | - helpTitle : 'Help on Plot Module', | |
40 | - helpFile : 'plotHelp', | |
41 | - | |
42 | - plotResultWindowsManager : new Ext.AbstractManager(), | |
43 | - | |
38 | + uiType: 'newPanelPlot', | |
39 | + helpTitle: 'Help on Plot Module', | |
40 | + helpFile: 'plotHelp', | |
41 | + | |
42 | + plotResultWindowsManager: new Ext.AbstractManager(), | |
43 | + | |
44 | 44 | multiPlotWin: null, |
45 | - | |
46 | - computeResultWindowSize : function(panelResult) { | |
45 | + | |
46 | + computeResultWindowSize: function (panelResult) { | |
47 | 47 | var size = panelResult.getImageSize(); |
48 | - size.width += 30; | |
48 | + size.width += 30; | |
49 | 49 | size.height += 95; |
50 | 50 | return size; |
51 | 51 | }, |
52 | - | |
53 | - computePreviewWindowSize : function(previewContent) { | |
52 | + | |
53 | + computePreviewWindowSize: function (previewContent) { | |
54 | 54 | var size = previewContent.getImageSize(); |
55 | - size.width += 30; | |
55 | + size.width += 30; | |
56 | 56 | size.height += 65; |
57 | 57 | return size; |
58 | 58 | }, |
59 | - | |
60 | - updateInteractiveSession : function(session, newplot) { | |
59 | + | |
60 | + updateInteractiveSession: function (session, newplot) { | |
61 | 61 | var me = this; |
62 | 62 | |
63 | 63 | |
64 | 64 | Ext.each(session.result, function (tabResult, index) { |
65 | + console.log(tabResult); | |
65 | 66 | if (logExecTime && tabResult.exectime) { |
66 | - console.log("CMD EXEC TIME FOR "+tabResult.plot+" = "+tabResult.exectime+"ms"); | |
67 | + console.log("CMD EXEC TIME FOR " + tabResult.plot + " = " + tabResult.exectime + "ms"); | |
67 | 68 | } |
68 | 69 | |
69 | 70 | if (tabResult.preview) { |
70 | 71 | var plotPreviewConfig = { |
71 | - folder : session.folder, | |
72 | - plotFile : tabResult.plot, | |
73 | - context : tabResult.context, | |
74 | - interactiveId : tabResult.id | |
72 | + folder: session.folder, | |
73 | + plotFile: tabResult.plot, | |
74 | + context: tabResult.context, | |
75 | + interactiveId: tabResult.id | |
75 | 76 | }; |
76 | 77 | me.updatePreview(plotPreviewConfig); |
77 | 78 | return; |
78 | 79 | } |
79 | 80 | |
80 | - var winResultId = tabResult.id+"-win"; | |
81 | - | |
81 | + var winResultId = tabResult.id + "-win"; | |
82 | + | |
82 | 83 | var winResult = me.getWindowResult(winResultId); |
83 | - | |
84 | + | |
85 | + | |
84 | 86 | var plotTabConfig = { |
85 | - folder : session.folder, | |
86 | - plotFile : tabResult.plot, | |
87 | - context : tabResult.context, | |
88 | - interactiveId : tabResult.id, | |
87 | + folder: session.folder, | |
88 | + plotFile: tabResult.plot, | |
89 | + context: tabResult.context, | |
90 | + interactiveId: tabResult.id, | |
89 | 91 | isInterval: tabResult.isInterval, |
90 | - ttName : tabResult.ttName, | |
91 | - ttIndex : tabResult.ttIndex, | |
92 | - ttNbIntervals : tabResult.ttNbIntervals, | |
93 | - ttFileIndex : tabResult.ttFileIndex, | |
92 | + ttName: tabResult.ttName, | |
93 | + ttIndex: tabResult.ttIndex, | |
94 | + ttNbIntervals: tabResult.ttNbIntervals, | |
95 | + ttFileIndex: tabResult.ttFileIndex, | |
94 | 96 | multiplot: tabResult.multiplot |
95 | 97 | }; |
96 | - | |
98 | + | |
97 | 99 | if (winResult == null) { |
98 | 100 | var x = 50 + tabResult.index * 50; |
99 | 101 | var y = 100 + tabResult.index * 20; |
... | ... | @@ -103,29 +105,29 @@ Ext.define('amdaDesktop.PlotModule', { |
103 | 105 | var size = me.computeResultWindowSize(panelResult); |
104 | 106 | |
105 | 107 | var win = myDesktopApp.getDesktop().createWindow({ |
106 | - id : tabResult.id+"-win", | |
107 | - title : tabResult.title, | |
108 | - width : size.width, | |
108 | + id: tabResult.id + "-win", | |
109 | + title: tabResult.title, | |
110 | + width: size.width, | |
109 | 111 | height: size.height, |
110 | - x : x, | |
111 | - y : y, | |
112 | + x: x, | |
113 | + y: y, | |
112 | 114 | layout: 'fit', |
113 | - items : [ | |
114 | - panelResult | |
115 | + items: [ | |
116 | + panelResult | |
115 | 117 | ], |
116 | 118 | listeners: { |
117 | - scope: me, | |
118 | - beforeclose: function(win,opt) { | |
119 | + scope: me, | |
120 | + beforeclose: function (win, opt) { | |
119 | 121 | me.plotResultWindowsManager.unregister(win); |
120 | 122 | }, |
121 | - afterrender: function(win,opt) { | |
123 | + afterrender: function (win, opt) { | |
122 | 124 | win.getPanelResult().updateConfig(tabResult.title, tabResult.multiplot); |
123 | 125 | } |
124 | 126 | }, |
125 | - getPanelResult: function() { | |
127 | + getPanelResult: function () { | |
126 | 128 | return panelResult; |
127 | 129 | }, |
128 | - updateTitle: function(multiplot) { | |
130 | + updateTitle: function (multiplot) { | |
129 | 131 | win.setTitle(tabResult.title + (multiplot ? ' - Synchronized to multiplot' : '')); |
130 | 132 | } |
131 | 133 | }); |
... | ... | @@ -143,19 +145,19 @@ Ext.define('amdaDesktop.PlotModule', { |
143 | 145 | } |
144 | 146 | }); |
145 | 147 | }, |
146 | - | |
147 | - closeInteractiveSession : function() { | |
148 | + | |
149 | + closeInteractiveSession: function () { | |
148 | 150 | var me = this; |
149 | 151 | this.plotResultWindowsManager.each(function (key, value, length) { |
150 | 152 | value.close(); |
151 | 153 | }); |
152 | - if (this.multiPlotWin) { | |
153 | - this.multiPlotWin.close(); | |
154 | - } | |
154 | + if (this.multiPlotWin) { | |
155 | + this.multiPlotWin.close(); | |
156 | + } | |
155 | 157 | }, |
156 | 158 | |
157 | - updatePlotResultTitle: function(tabIndex, title) { | |
158 | - var winResultId = 'plot_'+tabIndex+'-win'; | |
159 | + updatePlotResultTitle: function (tabIndex, title) { | |
160 | + var winResultId = 'plot_' + tabIndex + '-win'; | |
159 | 161 | var winResult = this.getWindowResult(winResultId); |
160 | 162 | if (winResult) { |
161 | 163 | winResult.setTitle(title); |
... | ... | @@ -163,11 +165,11 @@ Ext.define('amdaDesktop.PlotModule', { |
163 | 165 | if (winResult == item.win) { |
164 | 166 | item.setText(title); |
165 | 167 | } |
166 | - }); | |
168 | + }); | |
167 | 169 | } |
168 | 170 | }, |
169 | 171 | |
170 | - updatePreview : function(plotPreviewConfig) { | |
172 | + updatePreview: function (plotPreviewConfig) { | |
171 | 173 | var winPreviewId = "plot-preview-win"; |
172 | 174 | |
173 | 175 | var winPreview = this.getWindowResult(winPreviewId); |
... | ... | @@ -179,21 +181,21 @@ Ext.define('amdaDesktop.PlotModule', { |
179 | 181 | var size = this.computePreviewWindowSize(previewContent); |
180 | 182 | |
181 | 183 | var win = myDesktopApp.getDesktop().createWindow({ |
182 | - id : winPreviewId, | |
183 | - title : 'Plot Preview', | |
184 | - width : size.width, | |
184 | + id: winPreviewId, | |
185 | + title: 'Plot Preview', | |
186 | + width: size.width, | |
185 | 187 | height: size.height, |
186 | 188 | layout: 'fit', |
187 | - items : [ | |
188 | - previewContent | |
189 | + items: [ | |
190 | + previewContent | |
189 | 191 | ], |
190 | 192 | listeners: { |
191 | - scope: this, | |
192 | - beforeclose: function(win,opt) { | |
193 | + scope: this, | |
194 | + beforeclose: function (win, opt) { | |
193 | 195 | this.plotResultWindowsManager.unregister(win); |
194 | 196 | } |
195 | 197 | }, |
196 | - getPreviewContent: function() { | |
198 | + getPreviewContent: function () { | |
197 | 199 | return previewContent; |
198 | 200 | } |
199 | 201 | }); |
... | ... | @@ -209,14 +211,14 @@ Ext.define('amdaDesktop.PlotModule', { |
209 | 211 | winPreview.toFront(); |
210 | 212 | } |
211 | 213 | }, |
212 | - | |
213 | - getWindowResult: function(winResultId){ | |
214 | - if (!this.plotResultWindowsManager.get(winResultId)) return null; | |
215 | - return this.plotResultWindowsManager.get(winResultId); | |
214 | + | |
215 | + getWindowResult: function (winResultId) { | |
216 | + if (!this.plotResultWindowsManager.get(winResultId)) return null; | |
217 | + return this.plotResultWindowsManager.get(winResultId); | |
216 | 218 | }, |
217 | - | |
218 | - setTimeInterval : function(timeObj){ | |
219 | - var me = this; | |
219 | + | |
220 | + setTimeInterval: function (timeObj) { | |
221 | + var me = this; | |
220 | 222 | var desktop = this.app.getDesktop(); |
221 | 223 | var win = desktop.getWindow(this.id); |
222 | 224 | if (win) { |
... | ... | @@ -230,7 +232,7 @@ Ext.define('amdaDesktop.PlotModule', { |
230 | 232 | } |
231 | 233 | }, |
232 | 234 | |
233 | - addParameter : function(paramNode) { | |
235 | + addParameter: function (paramNode) { | |
234 | 236 | var me = this; |
235 | 237 | var desktop = this.app.getDesktop(); |
236 | 238 | var win = desktop.getWindow(this.id); |
... | ... | @@ -244,7 +246,7 @@ Ext.define('amdaDesktop.PlotModule', { |
244 | 246 | }); |
245 | 247 | } |
246 | 248 | }, |
247 | - editPlot : function(plotNode) { | |
249 | + editPlot: function (plotNode) { | |
248 | 250 | var me = this; |
249 | 251 | var desktop = this.app.getDesktop(); |
250 | 252 | var win = desktop.getWindow(this.id); |
... | ... | @@ -256,7 +258,7 @@ Ext.define('amdaDesktop.PlotModule', { |
256 | 258 | } |
257 | 259 | else { |
258 | 260 | // Plot UI is closed |
259 | - this.createWindow(null, function() { | |
261 | + this.createWindow(null, function () { | |
260 | 262 | //This is the onAfterCreateObject callback |
261 | 263 | //Add plot node to the multiplot object |
262 | 264 | me.linkedNode.get('object').plots().removeAll(); |
... | ... | @@ -265,7 +267,7 @@ Ext.define('amdaDesktop.PlotModule', { |
265 | 267 | } |
266 | 268 | }, |
267 | 269 | |
268 | - syncAfterRename: function(renamedNode) { | |
270 | + syncAfterRename: function (renamedNode) { | |
269 | 271 | var me = this; |
270 | 272 | var desktop = this.app.getDesktop(); |
271 | 273 | var win = desktop.getWindow(this.id); |
... | ... | @@ -275,8 +277,8 @@ Ext.define('amdaDesktop.PlotModule', { |
275 | 277 | } |
276 | 278 | }, |
277 | 279 | |
278 | - showMultiplotWin: function() { | |
279 | - var me = this; | |
280 | + showMultiplotWin: function () { | |
281 | + var me = this; | |
280 | 282 | var desktop = this.app.getDesktop(); |
281 | 283 | var win = desktop.getWindow(this.id); |
282 | 284 | |
... | ... | @@ -284,52 +286,52 @@ Ext.define('amdaDesktop.PlotModule', { |
284 | 286 | return; |
285 | 287 | } |
286 | 288 | |
287 | - if (!this.multiPlotWin) { | |
288 | - var multiPlotPanel = Ext.create('amdaUI.MultiPlotUI', | |
289 | - { | |
290 | - plotWin: me.getUiContent() | |
291 | - } | |
292 | - ); | |
293 | - this.multiPlotWin = myDesktopApp.getDesktop().createWindow({ | |
294 | - id : "multiplot-win", | |
295 | - title : "Multi Plot Manager", | |
296 | - width : 320, | |
297 | - height: 320, | |
298 | - minHeight: 300, | |
299 | - minWidth: 320, | |
300 | - layout: 'fit', | |
301 | - items : [ | |
302 | - multiPlotPanel | |
303 | - ], | |
304 | - listeners: { | |
305 | - beforeclose: function(win,opt) { | |
306 | - me.multiPlotWin = null; | |
307 | - me.getUiContent().enableSinglePlot(true); | |
308 | - me.plotResultWindowsManager.each(function (key, value, length) { | |
309 | - value.getPanelResult().updateConfig(value.getPanelResult().plotName, false); | |
310 | - }); | |
311 | - } | |
312 | - } | |
313 | - }); | |
314 | - } | |
289 | + if (!this.multiPlotWin) { | |
290 | + var multiPlotPanel = Ext.create('amdaUI.MultiPlotUI', | |
291 | + { | |
292 | + plotWin: me.getUiContent() | |
293 | + } | |
294 | + ); | |
295 | + this.multiPlotWin = myDesktopApp.getDesktop().createWindow({ | |
296 | + id: "multiplot-win", | |
297 | + title: "Multi Plot Manager", | |
298 | + width: 320, | |
299 | + height: 320, | |
300 | + minHeight: 300, | |
301 | + minWidth: 320, | |
302 | + layout: 'fit', | |
303 | + items: [ | |
304 | + multiPlotPanel | |
305 | + ], | |
306 | + listeners: { | |
307 | + beforeclose: function (win, opt) { | |
308 | + me.multiPlotWin = null; | |
309 | + me.getUiContent().enableSinglePlot(true); | |
310 | + me.plotResultWindowsManager.each(function (key, value, length) { | |
311 | + value.getPanelResult().updateConfig(value.getPanelResult().plotName, false); | |
312 | + }); | |
313 | + } | |
314 | + } | |
315 | + }); | |
316 | + } | |
315 | 317 | |
316 | 318 | this.getUiContent().enableSinglePlot(false); |
317 | - this.multiPlotWin.show(); | |
319 | + this.multiPlotWin.show(); | |
318 | 320 | |
319 | 321 | }, |
320 | 322 | |
321 | - refreshMultiPlot: function() { | |
323 | + refreshMultiPlot: function () { | |
322 | 324 | if (this.multiPlotWin) { |
323 | 325 | this.multiPlotWin.items.items[0].refreshMultiPlot(); |
324 | 326 | } |
325 | 327 | this.getUiContent().enableSinglePlot(!this.isMultiPlot()); |
326 | 328 | }, |
327 | 329 | |
328 | - isMultiPlot : function() { | |
330 | + isMultiPlot: function () { | |
329 | 331 | return this.multiPlotWin && !this.multiPlotWin.isHidden(); |
330 | 332 | }, |
331 | 333 | |
332 | - editInDownloadModule: function(plotNode) { | |
334 | + editInDownloadModule: function (plotNode) { | |
333 | 335 | var plotValues = plotNode.get('object').getJsonValues(); |
334 | 336 | var downloadValues = new Object(); |
335 | 337 | downloadValues.timesrc = plotValues.timesrc; |
... | ... |
js/app/views/PlotComponents/PlotZoomPlug.js
... | ... | @@ -18,7 +18,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
18 | 18 | extend: 'Ext.util.Observable', |
19 | 19 | alias: 'plugin.plotZoomPlugin', |
20 | 20 | requires: [ |
21 | - 'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType'], | |
21 | + 'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType', 'amdaPlotComp.plotFunction.CreatePlot'], | |
22 | 22 | |
23 | 23 | id: 'plot-zoom-plug', |
24 | 24 | |
... | ... | @@ -30,6 +30,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
30 | 30 | zoomType: '', |
31 | 31 | interactiveId: '', |
32 | 32 | panelId: -1, |
33 | + path_context_file: "", | |
33 | 34 | |
34 | 35 | linkedTTCatNode: null, |
35 | 36 | /** |
... | ... | @@ -59,8 +60,9 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
59 | 60 | * @param {*} listParams_ parameters displayed on the current panel |
60 | 61 | */ |
61 | 62 | setParameters: function (listParams_) { |
63 | + console.log(this.path_context_file); | |
62 | 64 | this.listParams = listParams_; |
63 | - this.plotFunctionParamField = new amdaPlotComp.plotFunction.ParamField({ params: this.listParams }); | |
65 | + //this.plotFunctionParamField = new amdaPlotComp.plotFunction.ParamField({ params: this.listParams }); | |
64 | 66 | this.plotFunctionType = new amdaPlotComp.plotFunction.FunctionType({}); |
65 | 67 | }, |
66 | 68 | |
... | ... | @@ -85,16 +87,15 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
85 | 87 | var minValue = this.form.getForm().findField('zoom-min-time').getValue(); |
86 | 88 | if (minValue <= max) { |
87 | 89 | this.form.getForm().findField('zoom-max-time').setValue(max); |
88 | - if (this.isPlotFunction) | |
89 | - this.plotFunctionParamField.setValues(minValue, max); | |
90 | + //if (this.isPlotFunction) | |
91 | + //this.plotFunctionParamField.setValues(minValue, max); | |
90 | 92 | } |
91 | 93 | else { |
92 | 94 | this.form.getForm().findField('zoom-min-time').setValue(max); |
93 | 95 | this.form.getForm().findField('zoom-max-time').setValue(minValue); |
94 | - if (this.isPlotFunction) | |
95 | - this.plotFunctionParamField.setValues(max, minValue); | |
96 | + // if (this.isPlotFunction) | |
97 | + // this.plotFunctionParamField.setValues(max, minValue); | |
96 | 98 | } |
97 | - | |
98 | 99 | } |
99 | 100 | else { |
100 | 101 | var minValue = this.form.getForm().findField('zoom-min-float').getValue(); |
... | ... | @@ -433,7 +434,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
433 | 434 | intervalFieldSet, |
434 | 435 | //Ici on rajoute les composants associรฉs ร la fonctionnalitรฉ 'PlotFunction' |
435 | 436 | me.isPlotFunction ? this.plotFunctionType : insertTTFieldSet, |
436 | - me.isPlotFunction ? this.plotFunctionParamField : null, | |
437 | + // me.isPlotFunction ? this.plotFunctionParamField : null, | |
437 | 438 | ], |
438 | 439 | fbar: [ |
439 | 440 | { |
... | ... | @@ -443,7 +444,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
443 | 444 | handler: function () { |
444 | 445 | if (this.zoomType == 'timeAxis') { |
445 | 446 | var minZoom = Ext.Date.format(this.form.getForm().findField('zoom-min-time').getValue(), 'Y-m-d\\TH:i:s.u'); |
446 | - var maxZoom = Ext.Date.format(this.form.getForm().findField('zoom-max-time').getValue(),'Y-m-d\TH:i:s.u'); | |
447 | + var maxZoom = Ext.Date.format(this.form.getForm().findField('zoom-max-time').getValue(), 'Y-m-d\TH:i:s.u'); | |
447 | 448 | } |
448 | 449 | else { |
449 | 450 | var minZoom = this.form.getForm().findField('zoom-min-float').getValue(); |
... | ... | @@ -460,7 +461,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
460 | 461 | const stop_time = this.form.getForm().findField('zoom-max-time').getValue(); |
461 | 462 | |
462 | 463 | let request_to_send = {}; |
463 | - request_to_send = Object.assign({}, me.plotFunctionType.getValues(), me.plotFunctionParamField.getValues()); | |
464 | + request_to_send = Object.assign({}, me.plotFunctionType.getValues()/*, me.plotFunctionParamField.getValues()*/); | |
464 | 465 | request_to_send = Object.assign({}, request_to_send, { |
465 | 466 | 'action': 'plotFunction', |
466 | 467 | 'interactiveId': this.interactiveId, |
... | ... | @@ -469,7 +470,22 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
469 | 470 | 'stoptime': stop_time |
470 | 471 | }); |
471 | 472 | |
472 | - this.hostCmp.callInteractivePlot(request_to_send); | |
473 | + console.log(request_to_send); | |
474 | + // const parent = this; | |
475 | + this.hostCmp.callInteractivePlot(request_to_send);/*, function () { | |
476 | + Ext.Ajax.request({ | |
477 | + url: parent.path_context_file, | |
478 | + success: function (response, options) { | |
479 | + var xmlDoc = response.responseXML; | |
480 | + const wind = new amdaPlotComp.plotFunction.CreatePlot({ | |
481 | + xmlDoc: xmlDoc, plotFunctionType: me.plotFunctionType, | |
482 | + plotFunctionParamField: me.plotFunctionParamField | |
483 | + }); | |
484 | + wind.show(); | |
485 | + wind.plot(); | |
486 | + } | |
487 | + }); | |
488 | + });*/ | |
473 | 489 | |
474 | 490 | } else { |
475 | 491 | this.hostCmp.callInteractivePlot({ |
... | ... | @@ -503,7 +519,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { |
503 | 519 | }); |
504 | 520 | |
505 | 521 | this.plotFunctionType.setParent(this.form.getForm()); |
506 | - this.plotFunctionParamField.setParent(this.form.getForm()); | |
522 | + // this.plotFunctionParamField.setParent(this.form.getForm()); | |
507 | 523 | return this.form; |
508 | 524 | }, |
509 | 525 | |
... | ... |
js/app/views/PlotComponents/plotFunction/CreatePlot.js
0 โ 100644
... | ... | @@ -0,0 +1,195 @@ |
1 | +/** | |
2 | + * Un composant de 'PlotFunction' qui permet ร l'utilisateur de sรฉlรฉctionner le type de fonction ร appliquer : FFT, SUM, ... | |
3 | + */ | |
4 | +Ext.define('amdaPlotComp.plotFunction.CreatePlot', { | |
5 | + extend: 'Ext.window.Window', | |
6 | + requires: [ | |
7 | + 'amdaUI.PlotlyContainer' | |
8 | + ], | |
9 | + | |
10 | + initComponent: function () { | |
11 | + | |
12 | + this.emptyChartConfig = { | |
13 | + xtype: 'amdaUI.PlotlyContainer', | |
14 | + id: 'visu-chart', | |
15 | + }; | |
16 | + | |
17 | + const config = | |
18 | + { | |
19 | + title: 'Apply a Function on Interval', | |
20 | + width: 700, | |
21 | + height: 500, | |
22 | + layout: 'fit', | |
23 | + bodyStyle: { background: '#FFFFFF' }, | |
24 | + modal: false, | |
25 | + resizable: true, | |
26 | + maximizable: true, | |
27 | + items: [ | |
28 | + this.emptyChartConfig | |
29 | + ] | |
30 | + }; | |
31 | + | |
32 | + Ext.apply(this, config); | |
33 | + this.callParent(arguments); | |
34 | + }, | |
35 | + | |
36 | + getXYData: function (data, serie_label) { | |
37 | + const separatorItems = "|"; | |
38 | + const separator = ";"; | |
39 | + | |
40 | + let legends = serie_label.split(separator); | |
41 | + legends.pop(); | |
42 | + | |
43 | + let items = data.split(separatorItems); | |
44 | + items.pop(); | |
45 | + | |
46 | + const xs = []; | |
47 | + const ys = []; | |
48 | + const labels = []; | |
49 | + for (j = 0; j < legends.length; j++) { | |
50 | + let i; | |
51 | + const y = []; | |
52 | + const x = []; | |
53 | + for (i = 0; i < items.length; i++) { | |
54 | + const temp = items[i].split(separator); | |
55 | + x.push(this.timeConverter(temp[0])); | |
56 | + y.push(temp[j + 1]); | |
57 | + } | |
58 | + ys.push(y); | |
59 | + xs.push(x); | |
60 | + labels.push(legends[j]); | |
61 | + } | |
62 | + | |
63 | + return { xs: xs, ys: ys, labels: labels }; | |
64 | + }, | |
65 | + | |
66 | + timeConverter: function (_timestamp) { | |
67 | + var a = new Date(_timestamp * 1000); | |
68 | + var year = a.getUTCFullYear(); | |
69 | + var month = a.getUTCMonth() + 1; | |
70 | + var date = a.getUTCDate(); | |
71 | + var hour = a.getUTCHours(); | |
72 | + var min = a.getUTCMinutes(); | |
73 | + var sec = a.getUTCSeconds(); | |
74 | + var time = year + '-' + month + '-' + date + ' ' + hour + ':' + min + ':' + sec; | |
75 | + return time; | |
76 | + }, | |
77 | + | |
78 | + applyFunction: function (y, dimSize) { | |
79 | + const type = this.plotFunctionType; | |
80 | + const valDict = type.getValues(); | |
81 | + const fct = valDict[type.plotFunctionItems.type.name]; | |
82 | + let out_y = []; | |
83 | + switch (fct) { | |
84 | + case type.plotFunctionItems.type.values.sum: | |
85 | + out_y = y; | |
86 | + break; | |
87 | + case type.plotFunctionItems.type.values.fft: | |
88 | + | |
89 | + break; | |
90 | + case type.plotFunctionItems.type.values.avg: | |
91 | + if (dimSize === -1) { | |
92 | + out_y = y.map(e => e / y.length); | |
93 | + } else { | |
94 | + out_y = y.map(e => e / dimSize); | |
95 | + } | |
96 | + break; | |
97 | + | |
98 | + default: | |
99 | + break; | |
100 | + } | |
101 | + return out_y; | |
102 | + }, | |
103 | + | |
104 | + | |
105 | + | |
106 | + plot: function () { | |
107 | + const param = this.xmlDoc.getElementsByTagName('parameter'); | |
108 | + const traces = []; | |
109 | + let yAxisLabel = ""; | |
110 | + let i; | |
111 | + for (i = 0; i < param.length; i++) { | |
112 | + const param_name = param[i].getAttribute('name'); | |
113 | + const param_unit = param[i].getAttribute('unit'); | |
114 | + const serie = param[i].getElementsByTagName('serie'); | |
115 | + | |
116 | + yAxisLabel += param_unit + "<br>"; | |
117 | + | |
118 | + for (let si = 0; si < serie.length; si++) { | |
119 | + const serie_label = serie[si].getAttribute('serie_label'); | |
120 | + const data_ = this.getXYData(serie[si].getAttribute('data'), serie_label); | |
121 | + let k; | |
122 | + | |
123 | + const dimSize = serie[si].getAttribute('dimSize'); | |
124 | + | |
125 | + for (k = 0; k < data_.ys.length; k++) { | |
126 | + let trace = {}; | |
127 | + trace.x = data_.xs[k]; | |
128 | + trace.y = this.applyFunction(data_.ys[k], parseInt(dimSize)); | |
129 | + trace.mode = 'lines+markers'; | |
130 | + trace.name = param_name + " (" + data_.labels[k] + ")"; | |
131 | + trace.type = 'scatter'; | |
132 | + | |
133 | + traces.push(trace); | |
134 | + } | |
135 | + } | |
136 | + } | |
137 | + | |
138 | + var chart = Ext.getCmp(this.emptyChartConfig.id); | |
139 | + | |
140 | + var config = this.emptyChartConfig; | |
141 | + | |
142 | + config.data = traces; | |
143 | + | |
144 | + const config_ = { | |
145 | + showgrid: true, | |
146 | + zeroline: true, | |
147 | + showline: true, | |
148 | + mirror: 'ticks', | |
149 | + gridcolor: '#bdbdbd', | |
150 | + gridwidth: 1, | |
151 | + zerolinecolor: '#969696', | |
152 | + zerolinewidth: 1, | |
153 | + linecolor: '#636363', | |
154 | + linewidth: 1 | |
155 | + }; | |
156 | + | |
157 | + let config_x = { | |
158 | + title: { | |
159 | + text: "Time, UT" | |
160 | + }, | |
161 | + type: 'date', | |
162 | + }; | |
163 | + | |
164 | + let config_y = { | |
165 | + title: { | |
166 | + text: this.format_label(yAxisLabel) | |
167 | + }, | |
168 | + exponentformat: "e" | |
169 | + } | |
170 | + | |
171 | + for (var key in config_) { | |
172 | + config_x[key] = config_[key]; | |
173 | + config_y[key] = config_[key]; | |
174 | + } | |
175 | + | |
176 | + config.layout = { | |
177 | + xaxis: config_x, | |
178 | + yaxis: config_y | |
179 | + }; | |
180 | + | |
181 | + if (chart) { | |
182 | + var chartPanel = chart.up(); | |
183 | + chartPanel.remove(chart); | |
184 | + } | |
185 | + var testPlotly = new amdaUI.PlotlyContainer(config); | |
186 | + chartPanel.insert(testPlotly); | |
187 | + }, | |
188 | + format_label: function (label) { | |
189 | + const power_2 = "\xB2"; | |
190 | + const power_3 = "\xB3"; | |
191 | + const amda_power_2 = "#u2"; | |
192 | + const amda_space = "#d"; | |
193 | + return label.replace(amda_power_2, power_2).replace(amda_space, " "); | |
194 | + } | |
195 | +}); | |
0 | 196 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/plotFunction/FunctionType.js
... | ... | @@ -13,6 +13,13 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
13 | 13 | field: "Function Type", |
14 | 14 | values: { |
15 | 15 | fft: "FFT", |
16 | + dft: "DFT", | |
17 | + sum: "SUM", | |
18 | + avg: "AVG" | |
19 | + }, | |
20 | + labels: { | |
21 | + fft: "DSP: FFT", | |
22 | + dft: "DSP: DFT", | |
16 | 23 | sum: "SUM", |
17 | 24 | avg: "AVG" |
18 | 25 | } |
... | ... | @@ -21,8 +28,9 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
21 | 28 | name: "scale_abscisse", |
22 | 29 | field: "Scale Abscisse", |
23 | 30 | values: { |
24 | - log: "Log", | |
25 | - linear: "Linear" | |
31 | + log: "logarithmic", | |
32 | + linear: "linear", | |
33 | + inherits: "Inherits" | |
26 | 34 | } |
27 | 35 | }, |
28 | 36 | abscisse: { |
... | ... | @@ -47,15 +55,19 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
47 | 55 | const data_function_type = []; |
48 | 56 | let item_type = {}; |
49 | 57 | item_type[key_] = this.plotFunctionItems.type.values.fft; |
50 | - item_type[name_] = this.plotFunctionItems.type.values.fft; | |
58 | + item_type[name_] = this.plotFunctionItems.type.labels.fft; | |
59 | + data_function_type.push(item_type); | |
60 | + item_type = {}; | |
61 | + item_type[key_] = this.plotFunctionItems.type.values.dft; | |
62 | + item_type[name_] = this.plotFunctionItems.type.labels.dft; | |
51 | 63 | data_function_type.push(item_type); |
52 | 64 | item_type = {}; |
53 | 65 | item_type[key_] = this.plotFunctionItems.type.values.sum; |
54 | - item_type[name_] = this.plotFunctionItems.type.values.sum; | |
66 | + item_type[name_] = this.plotFunctionItems.type.labels.sum; | |
55 | 67 | data_function_type.push(item_type); |
56 | 68 | item_type = {}; |
57 | 69 | item_type[key_] = this.plotFunctionItems.type.values.avg; |
58 | - item_type[name_] = this.plotFunctionItems.type.values.avg; | |
70 | + item_type[name_] = this.plotFunctionItems.type.labels.avg; | |
59 | 71 | data_function_type.push(item_type); |
60 | 72 | |
61 | 73 | const function_type = Ext.create('Ext.data.Store', { |
... | ... | @@ -65,10 +77,15 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
65 | 77 | |
66 | 78 | //Combo to choose type of scaling |
67 | 79 | const data_ = []; |
80 | + const item_inherits = {}; | |
81 | + item_inherits[key_] = this.plotFunctionItems.scale.values.inherits; | |
82 | + item_inherits[name_] = this.plotFunctionItems.scale.values.inherits; | |
83 | + data_.push(item_inherits); | |
84 | + | |
68 | 85 | const item_log = {}; |
69 | 86 | item_log[key_] = this.plotFunctionItems.scale.values.log; |
70 | 87 | item_log[name_] = this.plotFunctionItems.scale.values.log; |
71 | - //data_.push(item_log); | |
88 | + data_.push(item_log); | |
72 | 89 | |
73 | 90 | const item_linear = {}; |
74 | 91 | item_linear[key_] = this.plotFunctionItems.scale.values.linear; |
... | ... | @@ -120,7 +137,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
120 | 137 | name: this.plotFunctionItems.type.name, |
121 | 138 | listeners: { |
122 | 139 | change: function (combo, value) { |
123 | - if (value === me.plotFunctionItems.type.values.fft) { | |
140 | + if (value === me.plotFunctionItems.type.values.fft || value === me.plotFunctionItems.type.values.dft) { | |
124 | 141 | me.parent.findField(me.plotFunctionItems.abscisse.name).setVisible(true); |
125 | 142 | } |
126 | 143 | else { |
... | ... | @@ -137,7 +154,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
137 | 154 | displayField: name_, |
138 | 155 | valueField: key_, |
139 | 156 | editable: false, |
140 | - value: this.plotFunctionItems.scale.values.linear, | |
157 | + value: this.plotFunctionItems.scale.values.inherits, | |
141 | 158 | name: this.plotFunctionItems.scale.name |
142 | 159 | }, |
143 | 160 | { |
... | ... | @@ -160,7 +177,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
160 | 177 | displayField: name_, |
161 | 178 | valueField: key_, |
162 | 179 | editable: false, |
163 | - value: this.plotFunctionItems.scale.values.linear, | |
180 | + value: this.plotFunctionItems.scale.values.inherits, | |
164 | 181 | name: this.plotFunctionItems.scale_ordonnee.name |
165 | 182 | } |
166 | 183 | ] |
... | ... |
js/app/views/PlotComponents/plotFunction/ParamField.js
... | ... | @@ -18,7 +18,7 @@ Ext.define('amdaPlotComp.plotFunction.ParamField', { |
18 | 18 | |
19 | 19 | initComponent: function () { |
20 | 20 | const items_params = []; |
21 | - const minSampling = "Min Sampling (s)"; | |
21 | + const minSampling = "Sampling Time (s)"; | |
22 | 22 | const minValue = 0; |
23 | 23 | const labelWitdh = 120; |
24 | 24 | const width = 30; |
... | ... | @@ -101,7 +101,7 @@ Ext.define('amdaPlotComp.plotFunction.ParamField', { |
101 | 101 | const ui_item = this.parent.findField(this.label_number_field1 + param.id); |
102 | 102 | if (i > 0) list += delimeter; |
103 | 103 | if (ui_item !== undefined && ui_item !== null) { |
104 | - list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue(); | |
104 | + list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue() + delimeter + "5"; | |
105 | 105 | } |
106 | 106 | i++; |
107 | 107 | } |
... | ... |
js/app/views/PlotTabResultUI.js
... | ... | @@ -80,8 +80,11 @@ Ext.define('amdaUI.PlotTabResultUI', { |
80 | 80 | var size = this.getImageSize(); |
81 | 81 | // We need a list of parameters to compute the number of points needed to apply FFT |
82 | 82 | this.listParams = panelContext["parameters"]; |
83 | + console.log(this.crtContext); | |
84 | + zoomPlugin.path_context_file = 'data/' + sessionID + '/RES/' + this.configResult.folder + '/' + "plotFunction0_context.xml"; | |
83 | 85 | zoomPlugin.setParameters(this.listParams); |
84 | 86 | |
87 | + | |
85 | 88 | var me = this; |
86 | 89 | var insertIntervalItem = null; |
87 | 90 | Ext.each(panelContext.plotArea.axes, function (axis) { |
... | ... | @@ -219,7 +222,7 @@ Ext.define('amdaUI.PlotTabResultUI', { |
219 | 222 | me.contextualMenu.add(insertIntervalItem); |
220 | 223 | } |
221 | 224 | if (plotFunctionItem != null) { |
222 | - me.contextualMenu.insert(0,'-'); | |
225 | + me.contextualMenu.insert(0, '-'); | |
223 | 226 | me.contextualMenu.insert(0, plotFunctionItem); |
224 | 227 | } |
225 | 228 | }, |
... | ... | @@ -452,7 +455,7 @@ Ext.define('amdaUI.PlotTabResultUI', { |
452 | 455 | ttTotalField.setValue(this.crtContext.page.ttNbIntervals); |
453 | 456 | }, |
454 | 457 | |
455 | - callInteractivePlot: function (obj) { | |
458 | + callInteractivePlot: function (obj, postProcess = () => null) { | |
456 | 459 | loadMask.show(true); |
457 | 460 | |
458 | 461 | var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); |
... | ... | @@ -463,8 +466,10 @@ Ext.define('amdaUI.PlotTabResultUI', { |
463 | 466 | var t = e.getTransaction(); |
464 | 467 | if (e.status) { |
465 | 468 | if (result) { |
469 | + console.log(result); | |
466 | 470 | if (result.success) { |
467 | 471 | plotModule.updateInteractiveSession(result, false); |
472 | + postProcess(); | |
468 | 473 | } |
469 | 474 | else |
470 | 475 | myDesktopApp.errorMsg('Interactive action error - ' + result.message); |
... | ... | @@ -689,6 +694,8 @@ Ext.define('amdaUI.PlotTabResultUI', { |
689 | 694 | |
690 | 695 | init: function (configResult) { |
691 | 696 | this.crtContext = configResult.context; |
697 | + console.log(configResult); | |
698 | + this.configResult = configResult; | |
692 | 699 | this.interactiveId = configResult.interactiveId; |
693 | 700 | this.multiplot = (configResult.multiplot == true); |
694 | 701 | |
... | ... |