Commit 7c187e2696d84e1b7de6123eaa5a1811ded1a882
Exists in
master
and in
111 other branches
temporarMerge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM
Showing
9 changed files
with
158 additions
and
11 deletions
Show diff stats
js/app/models/PlotObjects/PlotBaseSerieObject.js
... | ... | @@ -31,6 +31,8 @@ Ext.define('amdaPlotObj.PlotBaseSerieObject', { |
31 | 31 | {name: 'serie-symbols-size', type: 'float'}, |
32 | 32 | {name: 'serie-symbols-color', type: 'string'}, |
33 | 33 | {name: 'serie-colored-param', type: 'string'}, |
34 | + {name: 'serie-value-min', type: 'float', useNull:true}, | |
35 | + {name: 'serie-value-max', type: 'float', useNull:true}, | |
34 | 36 | |
35 | 37 | //Time tick |
36 | 38 | {name: 'serie-timetick-activated', type: 'boolean'}, |
... | ... | @@ -139,6 +141,8 @@ Ext.define('amdaPlotObj.PlotBaseSerieObject', { |
139 | 141 | serieValues['serie-symbols-size'] = this.get('serie-symbols-size'); |
140 | 142 | serieValues['serie-symbols-color'] = this.get('serie-symbols-color'); |
141 | 143 | serieValues['serie-colored-param'] = this.get('serie-colored-param'); |
144 | + serieValues['serie-value-min'] = this.get('serie-value-min'); | |
145 | + serieValues['serie-value-max'] = this.get('serie-value-max'); | |
142 | 146 | |
143 | 147 | serieValues['serie-timetick-activated'] = this.get('serie-timetick-activated'); |
144 | 148 | serieValues['serie-timetick-type'] = this.get('serie-timetick-type'); | ... | ... |
js/app/models/PlotObjects/PlotSerieObject.js
... | ... | @@ -19,6 +19,8 @@ Ext.define('amdaPlotObj.PlotSerieObject', { |
19 | 19 | fields : [ |
20 | 20 | //Only used for xyPlot |
21 | 21 | {name: 'serie-xaxis-param', type: 'string'}, |
22 | + {name: 'serie-xvalue-min', type: 'float', useNull:true}, | |
23 | + {name: 'serie-xvalue-max', type: 'float', useNull:true}, | |
22 | 24 | {name: 'serie-resampling-mode', type: 'string'}, |
23 | 25 | |
24 | 26 | //Only used for timePlot |
... | ... | @@ -59,6 +61,8 @@ Ext.define('amdaPlotObj.PlotSerieObject', { |
59 | 61 | var serieValues = this.callParent(arguments); |
60 | 62 | |
61 | 63 | serieValues['serie-xaxis-param'] = this.get('serie-xaxis-param'); |
64 | + serieValues['serie-xvalue-min'] = this.get('serie-xvalue-min'); | |
65 | + serieValues['serie-xvalue-max'] = this.get('serie-xvalue-max'); | |
62 | 66 | serieValues['serie-resampling-mode'] = this.get('serie-resampling-mode'); |
63 | 67 | |
64 | 68 | serieValues['serie-errorbar-activated'] = this.get('serie-errorbar-activated'); | ... | ... |
js/app/models/PlotObjects/PlotSpectroObject.js
... | ... | @@ -21,7 +21,9 @@ Ext.define('amdaPlotObj.PlotSpectroObject', { |
21 | 21 | ], |
22 | 22 | |
23 | 23 | fields : [ |
24 | - {name: 'spectro-yaxis', type: 'string'} | |
24 | + {name: 'spectro-yaxis', type: 'string'}, | |
25 | + {name: 'spectro-value-min', type: 'float', useNull:true}, | |
26 | + {name: 'spectro-value-max', type: 'float', useNull:true} | |
25 | 27 | ], |
26 | 28 | |
27 | 29 | constructor: function(){ |
... | ... | @@ -48,6 +50,8 @@ Ext.define('amdaPlotObj.PlotSpectroObject', { |
48 | 50 | var spectroValues = new Object(); |
49 | 51 | |
50 | 52 | spectroValues['spectro-yaxis'] = this.get('spectro-yaxis'); |
53 | + spectroValues['spectro-value-min'] = this.get('spectro-value-min'); | |
54 | + spectroValues['spectro-value-max'] = this.get('spectro-value-max'); | |
51 | 55 | |
52 | 56 | return spectroValues; |
53 | 57 | } | ... | ... |
js/app/views/PlotComponents/PlotBaseSerieForm.js
... | ... | @@ -75,6 +75,13 @@ Ext.define('amdaPlotComp.PlotBaseSerieForm', { |
75 | 75 | ]; |
76 | 76 | }, |
77 | 77 | |
78 | + getValuesRangeItems: function() { | |
79 | + return [ | |
80 | + this.addStandardFloat('serie-value-min', 'Min value', -Number.MAX_VALUE, Number.MAX_VALUE, true), | |
81 | + this.addStandardFloat('serie-value-max', 'Max value', -Number.MAX_VALUE, Number.MAX_VALUE, true) | |
82 | + ]; | |
83 | + }, | |
84 | + | |
78 | 85 | getFormItems: function() { |
79 | 86 | var me = this; |
80 | 87 | |
... | ... | @@ -83,6 +90,7 @@ Ext.define('amdaPlotComp.PlotBaseSerieForm', { |
83 | 90 | me.object.set('serie-yaxis', value); |
84 | 91 | me.crtTree.refresh(); |
85 | 92 | }), |
93 | + this.addStandardFieldSet('Y Values range', '', this.getValuesRangeItems()), | |
86 | 94 | this.addStandardParamDropTarget('serie-colored-param', 'Colored Parameter'), |
87 | 95 | this.addStandardFieldSet('Lines', 'serie-lines-activated', this.addStandardLineItems('serie-lines')), |
88 | 96 | this.addStandardFieldSet('Symbols', 'serie-symbols-activated', this.addStandardSymbolsItems('serie-symbols')), | ... | ... |
js/app/views/PlotComponents/PlotContextManager.js
... | ... | @@ -82,6 +82,12 @@ Ext.define('amdaPlotComp.PlotContextManager', { |
82 | 82 | if (pixelMax == pixelMin) |
83 | 83 | return NaN; |
84 | 84 | |
85 | + if (axisContext.logarithmic) | |
86 | + { | |
87 | + var value = axisContext.min + (pixelValue - pixelMin)/(pixelMax - pixelMin)*(axisContext.max-axisContext.min); | |
88 | + return Math.pow(10,value); | |
89 | + } | |
90 | + | |
85 | 91 | return axisContext.min + (pixelValue - pixelMin)/(pixelMax - pixelMin)*(axisContext.max-axisContext.min); |
86 | 92 | } |
87 | 93 | }); |
88 | 94 | \ No newline at end of file | ... | ... |
js/app/views/PlotComponents/PlotSerieForm.js
... | ... | @@ -15,9 +15,12 @@ Ext.define('amdaPlotComp.PlotSerieForm', { |
15 | 15 | var isScatter = (plotType == 'xyPlot'); |
16 | 16 | |
17 | 17 | var xParamField = this.getForm().findField('serie-xaxis-param'); |
18 | + var xValueMinField = this.getForm().findField('serie-xvalue-min'); | |
19 | + var xValueFieldSet = xValueMinField.findParentByType('fieldset'); | |
18 | 20 | var resamplingModeField = this.getForm().findField('serie-resampling-mode'); |
19 | 21 | |
20 | 22 | xParamField.setVisible(isScatter); |
23 | + xValueFieldSet.setVisible(isScatter); | |
21 | 24 | resamplingModeField.setVisible(isScatter); |
22 | 25 | |
23 | 26 | var errorBarTypeField = this.getForm().findField('serie-errorbar-type'); |
... | ... | @@ -53,6 +56,13 @@ Ext.define('amdaPlotComp.PlotSerieForm', { |
53 | 56 | ]; |
54 | 57 | }, |
55 | 58 | |
59 | + getXValuesRangeItems: function() { | |
60 | + return [ | |
61 | + this.addStandardFloat('serie-xvalue-min', 'Min value', -Number.MAX_VALUE, Number.MAX_VALUE, true), | |
62 | + this.addStandardFloat('serie-xvalue-max', 'Max value', -Number.MAX_VALUE, Number.MAX_VALUE, true) | |
63 | + ]; | |
64 | + }, | |
65 | + | |
56 | 66 | getFormItems: function() { |
57 | 67 | var me = this; |
58 | 68 | |
... | ... | @@ -63,6 +73,7 @@ Ext.define('amdaPlotComp.PlotSerieForm', { |
63 | 73 | me.object.set('serie-xaxis-param', value); |
64 | 74 | me.crtTree.refresh(); |
65 | 75 | }), |
76 | + this.addStandardFieldSet('X Values range', '', this.getXValuesRangeItems()), | |
66 | 77 | this.addStandardCombo('serie-resampling-mode', 'Reference parameter for resampling', amdaPlotObj.PlotObjectConfig.availableResamplingModes) |
67 | 78 | ]; |
68 | 79 | ... | ... |
js/app/views/PlotComponents/PlotSpectroForm.js
... | ... | @@ -16,13 +16,21 @@ Ext.define('amdaPlotComp.PlotSpectroForm', { |
16 | 16 | this.loadRecord(this.object); |
17 | 17 | }, |
18 | 18 | |
19 | + getValuesRangeItems: function() { | |
20 | + return [ | |
21 | + this.addStandardFloat('spectro-value-min', 'Min value', -Number.MAX_VALUE, Number.MAX_VALUE, true), | |
22 | + this.addStandardFloat('spectro-value-max', 'Max value', -Number.MAX_VALUE, Number.MAX_VALUE, true) | |
23 | + ]; | |
24 | + }, | |
25 | + | |
19 | 26 | getFormItems: function() { |
20 | 27 | var me = this; |
21 | 28 | return [ |
22 | 29 | this.addStandardCombo('spectro-yaxis', 'Y axis', amdaPlotObj.PlotObjectConfig.availableYAxes, function(name, value, oldValue) { |
23 | 30 | me.object.set('spectro-yaxis', value); |
24 | 31 | me.crtTree.refresh(); |
25 | - }) | |
32 | + }), | |
33 | + this.addStandardFieldSet('Values range', '', this.getValuesRangeItems()) | |
26 | 34 | ]; |
27 | 35 | } |
28 | 36 | }); |
29 | 37 | \ No newline at end of file | ... | ... |
js/app/views/PlotTabResultUI.js
... | ... | @@ -31,6 +31,8 @@ Ext.define('amdaUI.PlotTabResultUI', { |
31 | 31 | isTTNavBar : false, |
32 | 32 | crtTTFileIndex : 0, |
33 | 33 | |
34 | + hiddenForm: null, | |
35 | + | |
34 | 36 | constructor: function(config) { |
35 | 37 | this.addEvents({'pagesize':true}); |
36 | 38 | |
... | ... | @@ -285,15 +287,48 @@ Ext.define('amdaUI.PlotTabResultUI', { |
285 | 287 | if (me.contextualMenu.items.getCount() > 0) |
286 | 288 | me.contextualMenu.add('-'); |
287 | 289 | |
288 | - me.contextualMenu.add({ | |
289 | - text:'Extend/Shift Time request', | |
290 | - handler : function () | |
291 | - { | |
292 | - var extendShiftPlugin = this.getPlugin('plot-extendshift-plugin-id'); | |
293 | - extendShiftPlugin.show(me.tabId); | |
294 | - }, | |
295 | - scope: me | |
296 | - }); | |
290 | + me.contextualMenu.add([ | |
291 | + { | |
292 | + text:'Extend/Shift Time request', | |
293 | + handler : function () | |
294 | + { | |
295 | + var extendShiftPlugin = this.getPlugin('plot-extendshift-plugin-id'); | |
296 | + extendShiftPlugin.show(me.tabId); | |
297 | + }, | |
298 | + scope: me | |
299 | + }, | |
300 | + '-', | |
301 | + { | |
302 | + text: 'Save Plot', | |
303 | + handler : function () | |
304 | + { | |
305 | + if (me.hiddenForm == null) | |
306 | + me.hiddenForm = Ext.create('Ext.form.Panel', { | |
307 | + title:'hiddenForm', | |
308 | + renderTo: Ext.getBody(), | |
309 | + standardSubmit: true, | |
310 | + url: 'php/downloadPlot.php', | |
311 | + timeout: 120000, | |
312 | + height:100, | |
313 | + width: 100, | |
314 | + hidden:true, | |
315 | + items:[ | |
316 | + ] | |
317 | + }); | |
318 | + | |
319 | + me.hiddenForm.getForm().submit({ | |
320 | + params: { | |
321 | + sessionId: sessionID, | |
322 | + tabId : me.tabId | |
323 | + }, | |
324 | + success: function(form, action) { | |
325 | + }, | |
326 | + failure: function(form, action) { | |
327 | + } | |
328 | + }); | |
329 | + } | |
330 | + } | |
331 | + ]); | |
297 | 332 | |
298 | 333 | me.contextualMenu.showAt(absoluteX, absoluteY); |
299 | 334 | } | ... | ... |
... | ... | @@ -0,0 +1,67 @@ |
1 | +<?php | |
2 | + | |
3 | +require_once 'config.php'; | |
4 | + | |
5 | +if (!isset($_POST['sessionId'])) | |
6 | +{ | |
7 | + header("HTTP/1.0 400 Bad Request"); | |
8 | + echo json_encode(array("success" => false, "error" => "Unknown session Id")); | |
9 | + exit; | |
10 | +} | |
11 | +$sessionId = $_POST['sessionId']; | |
12 | + | |
13 | +if (!isset($_POST['tabId'])) | |
14 | +{ | |
15 | + header("HTTP/1.0 400 Bad Request"); | |
16 | + echo json_encode(array("success" => false, "error" => "Unknown tab Id")); | |
17 | + exit; | |
18 | +} | |
19 | +$tabId = $_POST['tabId']; | |
20 | + | |
21 | +download_plot($sessionId, $tabId); | |
22 | + | |
23 | +function download_plot($sessionId, $tabId) | |
24 | +{ | |
25 | + // Must be fresh start | |
26 | + if( headers_sent() ) | |
27 | + { | |
28 | + header("HTTP/1.0 400 Bad Request"); | |
29 | + echo json_encode(array("success" => false, "error" => "Headers Sent")); | |
30 | + return; | |
31 | + } | |
32 | + | |
33 | + // Required for some browsers | |
34 | + if(ini_get('zlib.output_compression')) | |
35 | + ini_set('zlib.output_compression', 'Off'); | |
36 | + | |
37 | + //Build file path | |
38 | + $fullPath = USERPATH."/".$sessionId."/RES/Plot_/".$tabId.".png"; | |
39 | + // File Exists? | |
40 | + if( file_exists($fullPath) ){ | |
41 | + | |
42 | + // Parse Info / Get Extension | |
43 | + $fsize = filesize($fullPath); | |
44 | + $path_parts = pathinfo($fullPath); | |
45 | + $ctype="image/png"; | |
46 | + | |
47 | + header("Pragma: public"); // required | |
48 | + header("Expires: 0"); | |
49 | + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); | |
50 | + header("Cache-Control: private",false); // required for certain browsers | |
51 | + header("Content-Type: $ctype"); | |
52 | + header("Content-Disposition: attachment; filename=\"".basename($fullPath)."\";" ); | |
53 | + header("Content-Transfer-Encoding: binary"); | |
54 | + header("Content-Length: ".$fsize); | |
55 | + ob_clean(); | |
56 | + flush(); | |
57 | + readfile( $fullPath ); | |
58 | + | |
59 | + } else | |
60 | + { | |
61 | + header("HTTP/1.0 400 Bad Request"); | |
62 | + echo json_encode(array("success" => false, "error" => "No existing plot")); | |
63 | + return; | |
64 | + } | |
65 | +} | |
66 | + | |
67 | +?> | |
0 | 68 | \ No newline at end of file | ... | ... |