From bd8d75af507a82ac9abebbf95081ef6b2be48f7a Mon Sep 17 00:00:00 2001
From: Menouar AZIB <menouar.azib@akka.eu>
Date: Mon, 5 Dec 2022 10:24:07 +0100
Subject: [PATCH] Disable paramter config, minsampling... and Add 'Inherits' axis sacling

---
 js/app/controllers/PlotModule.js                         | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------------------------------------------------------------------------------
 js/app/views/PlotComponents/PlotZoomPlug.js              |  40 ++++++++++++++++++++++++++++------------
 js/app/views/PlotComponents/plotFunction/CreatePlot.js   | 195 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 js/app/views/PlotComponents/plotFunction/FunctionType.js |  35 ++++++++++++++++++++++++++---------
 js/app/views/PlotComponents/plotFunction/ParamField.js   |   4 ++--
 js/app/views/PlotTabResultUI.js                          |  11 +++++++++--
 6 files changed, 384 insertions(+), 147 deletions(-)
 create mode 100644 js/app/views/PlotComponents/plotFunction/CreatePlot.js

diff --git a/js/app/controllers/PlotModule.js b/js/app/controllers/PlotModule.js
index b617eb7..6c268d8 100644
--- a/js/app/controllers/PlotModule.js
+++ b/js/app/controllers/PlotModule.js
@@ -9,91 +9,93 @@
  */
 
 Ext.define('amdaDesktop.PlotModule', {
-	extend: 'amdaDesktop.InteractiveModule',
-	
-	requires: [
-	           'amdaUI.PlotUI',
-	           'amdaPlotObj.MultiplotRequestObject',
-	           'amdaModel.MultiplotNode',
-	           'amdaUI.PlotTabResultUI',
-	           'amdaPlotComp.PlotPreviewUI',
-		   'amdaUI.MultiPlotUI'
-	],
-	
-	contentId : 'plotUI',
-    linkedNode : null,
-    
+    extend: 'amdaDesktop.InteractiveModule',
+
+    requires: [
+        'amdaUI.PlotUI',
+        'amdaPlotObj.MultiplotRequestObject',
+        'amdaModel.MultiplotNode',
+        'amdaUI.PlotTabResultUI',
+        'amdaPlotComp.PlotPreviewUI',
+        'amdaUI.MultiPlotUI'
+    ],
+
+    contentId: 'plotUI',
+    linkedNode: null,
+
     /**
      * @cfg {String} data models
      * @required
      */
-    nodeDataModel : 'amdaModel.MultiplotNode',
-    
+    nodeDataModel: 'amdaModel.MultiplotNode',
+
     /**
      * @cfg {String} window definitions
      * @required
      */
-    width: 650, 
+    width: 650,
     height: 670,
-    uiType : 'newPanelPlot',
-    helpTitle : 'Help on Plot Module',
-    helpFile : 'plotHelp',
-     
-    plotResultWindowsManager : new Ext.AbstractManager(),
- 
+    uiType: 'newPanelPlot',
+    helpTitle: 'Help on Plot Module',
+    helpFile: 'plotHelp',
+
+    plotResultWindowsManager: new Ext.AbstractManager(),
+
     multiPlotWin: null,
-   
-    computeResultWindowSize : function(panelResult) {
+
+    computeResultWindowSize: function (panelResult) {
         var size = panelResult.getImageSize();
-        size.width  += 30;
+        size.width += 30;
         size.height += 95;
         return size;
     },
-	
-    computePreviewWindowSize : function(previewContent) {
+
+    computePreviewWindowSize: function (previewContent) {
         var size = previewContent.getImageSize();
-        size.width  += 30;
+        size.width += 30;
         size.height += 65;
         return size;
     },
-    
-    updateInteractiveSession : function(session, newplot) {
+
+    updateInteractiveSession: function (session, newplot) {
         var me = this;
 
 
         Ext.each(session.result, function (tabResult, index) {
+            console.log(tabResult);
             if (logExecTime && tabResult.exectime) {
-                console.log("CMD EXEC TIME FOR "+tabResult.plot+" = "+tabResult.exectime+"ms");
+                console.log("CMD EXEC TIME FOR " + tabResult.plot + " = " + tabResult.exectime + "ms");
             }
 
             if (tabResult.preview) {
                 var plotPreviewConfig = {
-                    folder   : session.folder,
-                    plotFile : tabResult.plot,
-                    context  : tabResult.context,
-                    interactiveId    : tabResult.id		
+                    folder: session.folder,
+                    plotFile: tabResult.plot,
+                    context: tabResult.context,
+                    interactiveId: tabResult.id
                 };
                 me.updatePreview(plotPreviewConfig);
                 return;
             }
 
-            var winResultId = tabResult.id+"-win";
-    		
+            var winResultId = tabResult.id + "-win";
+
             var winResult = me.getWindowResult(winResultId);
-    		
+
+
             var plotTabConfig = {
-                folder   : session.folder,
-                plotFile : tabResult.plot,
-                context  : tabResult.context,
-                interactiveId : tabResult.id,
+                folder: session.folder,
+                plotFile: tabResult.plot,
+                context: tabResult.context,
+                interactiveId: tabResult.id,
                 isInterval: tabResult.isInterval,
-                ttName : tabResult.ttName,
-                ttIndex : tabResult.ttIndex,
-                ttNbIntervals : tabResult.ttNbIntervals,
-                ttFileIndex : tabResult.ttFileIndex,
+                ttName: tabResult.ttName,
+                ttIndex: tabResult.ttIndex,
+                ttNbIntervals: tabResult.ttNbIntervals,
+                ttFileIndex: tabResult.ttFileIndex,
                 multiplot: tabResult.multiplot
             };
-    		
+
             if (winResult == null) {
                 var x = 50 + tabResult.index * 50;
                 var y = 100 + tabResult.index * 20;
@@ -103,29 +105,29 @@ Ext.define('amdaDesktop.PlotModule', {
                 var size = me.computeResultWindowSize(panelResult);
 
                 var win = myDesktopApp.getDesktop().createWindow({
-                    id    : tabResult.id+"-win",
-                    title : tabResult.title,
-                    width : size.width,
+                    id: tabResult.id + "-win",
+                    title: tabResult.title,
+                    width: size.width,
                     height: size.height,
-                    x : x,
-                    y : y,
+                    x: x,
+                    y: y,
                     layout: 'fit',
-                    items : [ 
-                        panelResult 
+                    items: [
+                        panelResult
                     ],
                     listeners: {
-                        scope: me,				  
-                        beforeclose: function(win,opt) {
+                        scope: me,
+                        beforeclose: function (win, opt) {
                             me.plotResultWindowsManager.unregister(win);
                         },
-                        afterrender: function(win,opt) {
+                        afterrender: function (win, opt) {
                             win.getPanelResult().updateConfig(tabResult.title, tabResult.multiplot);
                         }
                     },
-                    getPanelResult: function() {
+                    getPanelResult: function () {
                         return panelResult;
                     },
-                    updateTitle: function(multiplot) {
+                    updateTitle: function (multiplot) {
                         win.setTitle(tabResult.title + (multiplot ? ' - Synchronized to multiplot' : ''));
                     }
                 });
@@ -143,19 +145,19 @@ Ext.define('amdaDesktop.PlotModule', {
             }
         });
     },
-    
-    closeInteractiveSession : function() {
+
+    closeInteractiveSession: function () {
         var me = this;
         this.plotResultWindowsManager.each(function (key, value, length) {
             value.close();
         });
-	if (this.multiPlotWin) {
-		this.multiPlotWin.close();
-	}
+        if (this.multiPlotWin) {
+            this.multiPlotWin.close();
+        }
     },
 
-    updatePlotResultTitle: function(tabIndex, title) {
-        var winResultId = 'plot_'+tabIndex+'-win';
+    updatePlotResultTitle: function (tabIndex, title) {
+        var winResultId = 'plot_' + tabIndex + '-win';
         var winResult = this.getWindowResult(winResultId);
         if (winResult) {
             winResult.setTitle(title);
@@ -163,11 +165,11 @@ Ext.define('amdaDesktop.PlotModule', {
                 if (winResult == item.win) {
                     item.setText(title);
                 }
-            });  
+            });
         }
     },
 
-    updatePreview : function(plotPreviewConfig) {
+    updatePreview: function (plotPreviewConfig) {
         var winPreviewId = "plot-preview-win";
 
         var winPreview = this.getWindowResult(winPreviewId);
@@ -179,21 +181,21 @@ Ext.define('amdaDesktop.PlotModule', {
             var size = this.computePreviewWindowSize(previewContent);
 
             var win = myDesktopApp.getDesktop().createWindow({
-                id    : winPreviewId,
-                title : 'Plot Preview',
-                width : size.width,
+                id: winPreviewId,
+                title: 'Plot Preview',
+                width: size.width,
                 height: size.height,
                 layout: 'fit',
-                items : [ 
-                    previewContent 
+                items: [
+                    previewContent
                 ],
                 listeners: {
-                    scope: this,				  
-                    beforeclose: function(win,opt) {
+                    scope: this,
+                    beforeclose: function (win, opt) {
                         this.plotResultWindowsManager.unregister(win);
                     }
                 },
-                getPreviewContent: function() {
+                getPreviewContent: function () {
                     return previewContent;
                 }
             });
@@ -209,14 +211,14 @@ Ext.define('amdaDesktop.PlotModule', {
             winPreview.toFront();
         }
     },
-    
-    getWindowResult: function(winResultId){
-	    if (!this.plotResultWindowsManager.get(winResultId)) return null;
-	    return this.plotResultWindowsManager.get(winResultId);	    
+
+    getWindowResult: function (winResultId) {
+        if (!this.plotResultWindowsManager.get(winResultId)) return null;
+        return this.plotResultWindowsManager.get(winResultId);
     },
-    
-    setTimeInterval : function(timeObj){
-         var me = this;
+
+    setTimeInterval: function (timeObj) {
+        var me = this;
         var desktop = this.app.getDesktop();
         var win = desktop.getWindow(this.id);
         if (win) {
@@ -230,7 +232,7 @@ Ext.define('amdaDesktop.PlotModule', {
         }
     },
 
-    addParameter : function(paramNode) {
+    addParameter: function (paramNode) {
         var me = this;
         var desktop = this.app.getDesktop();
         var win = desktop.getWindow(this.id);
@@ -244,7 +246,7 @@ Ext.define('amdaDesktop.PlotModule', {
             });
         }
     },
-    editPlot : function(plotNode) {
+    editPlot: function (plotNode) {
         var me = this;
         var desktop = this.app.getDesktop();
         var win = desktop.getWindow(this.id);
@@ -256,7 +258,7 @@ Ext.define('amdaDesktop.PlotModule', {
         }
         else {
             // Plot UI is closed
-            this.createWindow(null, function() {
+            this.createWindow(null, function () {
                 //This is the onAfterCreateObject callback
                 //Add plot node to the multiplot object
                 me.linkedNode.get('object').plots().removeAll();
@@ -265,7 +267,7 @@ Ext.define('amdaDesktop.PlotModule', {
         }
     },
 
-    syncAfterRename: function(renamedNode) {
+    syncAfterRename: function (renamedNode) {
         var me = this;
         var desktop = this.app.getDesktop();
         var win = desktop.getWindow(this.id);
@@ -275,8 +277,8 @@ Ext.define('amdaDesktop.PlotModule', {
         }
     },
 
-    showMultiplotWin: function() {
-	var me = this;
+    showMultiplotWin: function () {
+        var me = this;
         var desktop = this.app.getDesktop();
         var win = desktop.getWindow(this.id);
 
@@ -284,52 +286,52 @@ Ext.define('amdaDesktop.PlotModule', {
             return;
         }
 
-	if (!this.multiPlotWin) {
-		var multiPlotPanel = Ext.create('amdaUI.MultiPlotUI',
-			{
-                            plotWin: me.getUiContent()
-			}
-		);
-		this.multiPlotWin = myDesktopApp.getDesktop().createWindow({
-			id    : "multiplot-win",
-			title : "Multi Plot Manager",
-			width : 320,
-			height: 320,
-			minHeight: 300,
-			minWidth: 320,
-			layout: 'fit',
-			items : [
-				multiPlotPanel
-			],
-                        listeners: {
-                            beforeclose: function(win,opt) {
-                                me.multiPlotWin = null;
-                                me.getUiContent().enableSinglePlot(true);
-				me.plotResultWindowsManager.each(function (key, value, length) {
-					value.getPanelResult().updateConfig(value.getPanelResult().plotName, false);
-				});
-                            }
-                        }
-		});
-	}
+        if (!this.multiPlotWin) {
+            var multiPlotPanel = Ext.create('amdaUI.MultiPlotUI',
+                {
+                    plotWin: me.getUiContent()
+                }
+            );
+            this.multiPlotWin = myDesktopApp.getDesktop().createWindow({
+                id: "multiplot-win",
+                title: "Multi Plot Manager",
+                width: 320,
+                height: 320,
+                minHeight: 300,
+                minWidth: 320,
+                layout: 'fit',
+                items: [
+                    multiPlotPanel
+                ],
+                listeners: {
+                    beforeclose: function (win, opt) {
+                        me.multiPlotWin = null;
+                        me.getUiContent().enableSinglePlot(true);
+                        me.plotResultWindowsManager.each(function (key, value, length) {
+                            value.getPanelResult().updateConfig(value.getPanelResult().plotName, false);
+                        });
+                    }
+                }
+            });
+        }
 
         this.getUiContent().enableSinglePlot(false);
-	this.multiPlotWin.show();
+        this.multiPlotWin.show();
 
     },
 
-    refreshMultiPlot: function() {
+    refreshMultiPlot: function () {
         if (this.multiPlotWin) {
             this.multiPlotWin.items.items[0].refreshMultiPlot();
         }
         this.getUiContent().enableSinglePlot(!this.isMultiPlot());
     },
 
-    isMultiPlot : function() {
+    isMultiPlot: function () {
         return this.multiPlotWin && !this.multiPlotWin.isHidden();
     },
 
-    editInDownloadModule: function(plotNode) {
+    editInDownloadModule: function (plotNode) {
         var plotValues = plotNode.get('object').getJsonValues();
         var downloadValues = new Object();
         downloadValues.timesrc = plotValues.timesrc;
diff --git a/js/app/views/PlotComponents/PlotZoomPlug.js b/js/app/views/PlotComponents/PlotZoomPlug.js
index 2c2bb6d..c936fa1 100644
--- a/js/app/views/PlotComponents/PlotZoomPlug.js
+++ b/js/app/views/PlotComponents/PlotZoomPlug.js
@@ -18,7 +18,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
   extend: 'Ext.util.Observable',
   alias: 'plugin.plotZoomPlugin',
   requires: [
-    'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType'],
+    'amdaPlotComp.plotFunction.ParamField', 'amdaPlotComp.plotFunction.FunctionType', 'amdaPlotComp.plotFunction.CreatePlot'],
 
   id: 'plot-zoom-plug',
 
@@ -30,6 +30,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
   zoomType: '',
   interactiveId: '',
   panelId: -1,
+  path_context_file: "",
 
   linkedTTCatNode: null,
   /**
@@ -59,8 +60,9 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
    * @param {*} listParams_  parameters displayed on the current panel
    */
   setParameters: function (listParams_) {
+    console.log(this.path_context_file);
     this.listParams = listParams_;
-    this.plotFunctionParamField = new amdaPlotComp.plotFunction.ParamField({ params: this.listParams });
+    //this.plotFunctionParamField = new amdaPlotComp.plotFunction.ParamField({ params: this.listParams });
     this.plotFunctionType = new amdaPlotComp.plotFunction.FunctionType({});
   },
 
@@ -85,16 +87,15 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
       var minValue = this.form.getForm().findField('zoom-min-time').getValue();
       if (minValue <= max) {
         this.form.getForm().findField('zoom-max-time').setValue(max);
-        if (this.isPlotFunction)
-          this.plotFunctionParamField.setValues(minValue, max);
+        //if (this.isPlotFunction)
+        //this.plotFunctionParamField.setValues(minValue, max);
       }
       else {
         this.form.getForm().findField('zoom-min-time').setValue(max);
         this.form.getForm().findField('zoom-max-time').setValue(minValue);
-        if (this.isPlotFunction)
-          this.plotFunctionParamField.setValues(max, minValue);
+        // if (this.isPlotFunction)
+        // this.plotFunctionParamField.setValues(max, minValue);
       }
-
     }
     else {
       var minValue = this.form.getForm().findField('zoom-min-float').getValue();
@@ -433,7 +434,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
         intervalFieldSet,
         //Ici on rajoute les composants associés à la fonctionnalité 'PlotFunction'
         me.isPlotFunction ? this.plotFunctionType : insertTTFieldSet,
-        me.isPlotFunction ? this.plotFunctionParamField : null,
+        // me.isPlotFunction ? this.plotFunctionParamField : null,
       ],
       fbar: [
         {
@@ -443,7 +444,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
           handler: function () {
             if (this.zoomType == 'timeAxis') {
               var minZoom = Ext.Date.format(this.form.getForm().findField('zoom-min-time').getValue(), 'Y-m-d\\TH:i:s.u');
-              var maxZoom = Ext.Date.format(this.form.getForm().findField('zoom-max-time').getValue(),'Y-m-d\\TH:i:s.u');
+              var maxZoom = Ext.Date.format(this.form.getForm().findField('zoom-max-time').getValue(), 'Y-m-d\\TH:i:s.u');
             }
             else {
               var minZoom = this.form.getForm().findField('zoom-min-float').getValue();
@@ -460,7 +461,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
               const stop_time = this.form.getForm().findField('zoom-max-time').getValue();
 
               let request_to_send = {};
-              request_to_send = Object.assign({}, me.plotFunctionType.getValues(), me.plotFunctionParamField.getValues());
+              request_to_send = Object.assign({}, me.plotFunctionType.getValues()/*, me.plotFunctionParamField.getValues()*/);
               request_to_send = Object.assign({}, request_to_send, {
                 'action': 'plotFunction',
                 'interactiveId': this.interactiveId,
@@ -469,7 +470,22 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
                 'stoptime': stop_time
               });
 
-              this.hostCmp.callInteractivePlot(request_to_send);
+              console.log(request_to_send);
+              // const parent = this;
+              this.hostCmp.callInteractivePlot(request_to_send);/*, function () {
+                Ext.Ajax.request({
+                  url: parent.path_context_file,
+                  success: function (response, options) {
+                    var xmlDoc = response.responseXML;
+                    const wind = new amdaPlotComp.plotFunction.CreatePlot({
+                      xmlDoc: xmlDoc, plotFunctionType: me.plotFunctionType,
+                      plotFunctionParamField: me.plotFunctionParamField
+                    });
+                    wind.show();
+                    wind.plot();
+                  }
+                });
+              });*/
 
             } else {
               this.hostCmp.callInteractivePlot({
@@ -503,7 +519,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', {
     });
 
     this.plotFunctionType.setParent(this.form.getForm());
-    this.plotFunctionParamField.setParent(this.form.getForm());
+    // this.plotFunctionParamField.setParent(this.form.getForm());
     return this.form;
   },
 
diff --git a/js/app/views/PlotComponents/plotFunction/CreatePlot.js b/js/app/views/PlotComponents/plotFunction/CreatePlot.js
new file mode 100644
index 0000000..27385a8
--- /dev/null
+++ b/js/app/views/PlotComponents/plotFunction/CreatePlot.js
@@ -0,0 +1,195 @@
+/**
+ * Un composant de 'PlotFunction' qui permet à l'utilisateur de séléctionner le type de fonction à appliquer : FFT, SUM, ...
+ */
+Ext.define('amdaPlotComp.plotFunction.CreatePlot', {
+    extend: 'Ext.window.Window',
+    requires: [
+        'amdaUI.PlotlyContainer'
+    ],
+
+    initComponent: function () {
+
+        this.emptyChartConfig = {
+            xtype: 'amdaUI.PlotlyContainer',
+            id: 'visu-chart',
+        };
+
+        const config =
+        {
+            title: 'Apply a Function on Interval',
+            width: 700,
+            height: 500,
+            layout: 'fit',
+            bodyStyle: { background: '#FFFFFF' },
+            modal: false,
+            resizable: true,
+            maximizable: true,
+            items: [
+                this.emptyChartConfig
+            ]
+        };
+
+        Ext.apply(this, config);
+        this.callParent(arguments);
+    },
+
+    getXYData: function (data, serie_label) {
+        const separatorItems = "|";
+        const separator = ";";
+
+        let legends = serie_label.split(separator);
+        legends.pop();
+
+        let items = data.split(separatorItems);
+        items.pop();
+
+        const xs = [];
+        const ys = [];
+        const labels = [];
+        for (j = 0; j < legends.length; j++) {
+            let i;
+            const y = [];
+            const x = [];
+            for (i = 0; i < items.length; i++) {
+                const temp = items[i].split(separator);
+                x.push(this.timeConverter(temp[0]));
+                y.push(temp[j + 1]);
+            }
+            ys.push(y);
+            xs.push(x);
+            labels.push(legends[j]);
+        }
+
+        return { xs: xs, ys: ys, labels: labels };
+    },
+
+    timeConverter: function (_timestamp) {
+        var a = new Date(_timestamp * 1000);
+        var year = a.getUTCFullYear();
+        var month = a.getUTCMonth() + 1;
+        var date = a.getUTCDate();
+        var hour = a.getUTCHours();
+        var min = a.getUTCMinutes();
+        var sec = a.getUTCSeconds();
+        var time = year + '-' + month + '-' + date + ' ' + hour + ':' + min + ':' + sec;
+        return time;
+    },
+
+    applyFunction: function (y, dimSize) {
+        const type = this.plotFunctionType;
+        const valDict = type.getValues();
+        const fct = valDict[type.plotFunctionItems.type.name];
+        let out_y = [];
+        switch (fct) {
+            case type.plotFunctionItems.type.values.sum:
+                out_y = y;
+                break;
+            case type.plotFunctionItems.type.values.fft:
+
+                break;
+            case type.plotFunctionItems.type.values.avg:
+                if (dimSize === -1) {
+                    out_y = y.map(e => e / y.length);
+                } else {
+                    out_y = y.map(e => e / dimSize);
+                }
+                break;
+
+            default:
+                break;
+        }
+        return out_y;
+    },
+
+
+
+    plot: function () {
+        const param = this.xmlDoc.getElementsByTagName('parameter');
+        const traces = [];
+        let yAxisLabel = "";
+        let i;
+        for (i = 0; i < param.length; i++) {
+            const param_name = param[i].getAttribute('name');
+            const param_unit = param[i].getAttribute('unit');
+            const serie = param[i].getElementsByTagName('serie');
+
+            yAxisLabel += param_unit + "<br>";
+
+            for (let si = 0; si < serie.length; si++) {
+                const serie_label = serie[si].getAttribute('serie_label');
+                const data_ = this.getXYData(serie[si].getAttribute('data'), serie_label);
+                let k;
+
+                const dimSize = serie[si].getAttribute('dimSize');
+
+                for (k = 0; k < data_.ys.length; k++) {
+                    let trace = {};
+                    trace.x = data_.xs[k];
+                    trace.y = this.applyFunction(data_.ys[k], parseInt(dimSize));
+                    trace.mode = 'lines+markers';
+                    trace.name = param_name + " (" + data_.labels[k] + ")";
+                    trace.type = 'scatter';
+
+                    traces.push(trace);
+                }
+            }
+        }
+
+        var chart = Ext.getCmp(this.emptyChartConfig.id);
+
+        var config = this.emptyChartConfig;
+
+        config.data = traces;
+
+        const config_ = {
+            showgrid: true,
+            zeroline: true,
+            showline: true,
+            mirror: 'ticks',
+            gridcolor: '#bdbdbd',
+            gridwidth: 1,
+            zerolinecolor: '#969696',
+            zerolinewidth: 1,
+            linecolor: '#636363',
+            linewidth: 1
+        };
+
+        let config_x = {
+            title: {
+                text: "Time, UT"
+            },
+            type: 'date',
+        };
+
+        let config_y = {
+            title: {
+                text: this.format_label(yAxisLabel)
+            },
+            exponentformat: "e"
+        }
+
+        for (var key in config_) {
+            config_x[key] = config_[key];
+            config_y[key] = config_[key];
+        }
+
+        config.layout = {
+            xaxis: config_x,
+            yaxis: config_y
+        };
+
+        if (chart) {
+            var chartPanel = chart.up();
+            chartPanel.remove(chart);
+        }
+        var testPlotly = new amdaUI.PlotlyContainer(config);
+        chartPanel.insert(testPlotly);
+    },
+    format_label: function (label) {
+        const power_2 = "\xB2";
+        const power_3 = "\xB3";
+        const amda_power_2 = "#u2";
+        const amda_space = "#d";
+        return label.replace(amda_power_2, power_2).replace(amda_space, " ");
+    }
+});
\ No newline at end of file
diff --git a/js/app/views/PlotComponents/plotFunction/FunctionType.js b/js/app/views/PlotComponents/plotFunction/FunctionType.js
index 82fe671..7ee1a05 100644
--- a/js/app/views/PlotComponents/plotFunction/FunctionType.js
+++ b/js/app/views/PlotComponents/plotFunction/FunctionType.js
@@ -13,6 +13,13 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
             field: "Function Type",
             values: {
                 fft: "FFT",
+                dft: "DFT",
+                sum: "SUM",
+                avg: "AVG"
+            },
+            labels: {
+                fft: "DSP: FFT",
+                dft: "DSP: DFT",
                 sum: "SUM",
                 avg: "AVG"
             }
@@ -21,8 +28,9 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
             name: "scale_abscisse",
             field: "Scale Abscisse",
             values: {
-                log: "Log",
-                linear: "Linear"
+                log: "logarithmic",
+                linear: "linear",
+                inherits: "Inherits"
             }
         },
         abscisse: {
@@ -47,15 +55,19 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
         const data_function_type = [];
         let item_type = {};
         item_type[key_] = this.plotFunctionItems.type.values.fft;
-        item_type[name_] = this.plotFunctionItems.type.values.fft;
+        item_type[name_] = this.plotFunctionItems.type.labels.fft;
+        data_function_type.push(item_type);
+        item_type = {};
+        item_type[key_] = this.plotFunctionItems.type.values.dft;
+        item_type[name_] = this.plotFunctionItems.type.labels.dft;
         data_function_type.push(item_type);
         item_type = {};
         item_type[key_] = this.plotFunctionItems.type.values.sum;
-        item_type[name_] = this.plotFunctionItems.type.values.sum;
+        item_type[name_] = this.plotFunctionItems.type.labels.sum;
         data_function_type.push(item_type);
         item_type = {};
         item_type[key_] = this.plotFunctionItems.type.values.avg;
-        item_type[name_] = this.plotFunctionItems.type.values.avg;
+        item_type[name_] = this.plotFunctionItems.type.labels.avg;
         data_function_type.push(item_type);
 
         const function_type = Ext.create('Ext.data.Store', {
@@ -65,10 +77,15 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
 
         //Combo to choose type of scaling
         const data_ = [];
+        const item_inherits = {};
+        item_inherits[key_] = this.plotFunctionItems.scale.values.inherits;
+        item_inherits[name_] = this.plotFunctionItems.scale.values.inherits;
+        data_.push(item_inherits);
+
         const item_log = {};
         item_log[key_] = this.plotFunctionItems.scale.values.log;
         item_log[name_] = this.plotFunctionItems.scale.values.log;
-        //data_.push(item_log);
+        data_.push(item_log);
 
         const item_linear = {};
         item_linear[key_] = this.plotFunctionItems.scale.values.linear;
@@ -120,7 +137,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
                     name: this.plotFunctionItems.type.name,
                     listeners: {
                         change: function (combo, value) {
-                            if (value === me.plotFunctionItems.type.values.fft) {
+                            if (value === me.plotFunctionItems.type.values.fft || value === me.plotFunctionItems.type.values.dft) {
                                 me.parent.findField(me.plotFunctionItems.abscisse.name).setVisible(true);
                             }
                             else {
@@ -137,7 +154,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
                     displayField: name_,
                     valueField: key_,
                     editable: false,
-                    value: this.plotFunctionItems.scale.values.linear,
+                    value: this.plotFunctionItems.scale.values.inherits,
                     name: this.plotFunctionItems.scale.name
                 },
                 {
@@ -160,7 +177,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', {
                     displayField: name_,
                     valueField: key_,
                     editable: false,
-                    value: this.plotFunctionItems.scale.values.linear,
+                    value: this.plotFunctionItems.scale.values.inherits,
                     name: this.plotFunctionItems.scale_ordonnee.name
                 }
             ]
diff --git a/js/app/views/PlotComponents/plotFunction/ParamField.js b/js/app/views/PlotComponents/plotFunction/ParamField.js
index 4839b10..83c7042 100644
--- a/js/app/views/PlotComponents/plotFunction/ParamField.js
+++ b/js/app/views/PlotComponents/plotFunction/ParamField.js
@@ -18,7 +18,7 @@ Ext.define('amdaPlotComp.plotFunction.ParamField', {
 
     initComponent: function () {
         const items_params = [];
-        const minSampling = "Min Sampling (s)";
+        const minSampling = "Sampling Time (s)";
         const minValue = 0;
         const labelWitdh = 120;
         const width = 30;
@@ -101,7 +101,7 @@ Ext.define('amdaPlotComp.plotFunction.ParamField', {
             const ui_item = this.parent.findField(this.label_number_field1 + param.id);
             if (i > 0) list += delimeter;
             if (ui_item !== undefined && ui_item !== null) {
-                list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue();
+                list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue() + delimeter + "5";
             }
             i++;
         }
diff --git a/js/app/views/PlotTabResultUI.js b/js/app/views/PlotTabResultUI.js
index bf4d9ea..8c13b01 100644
--- a/js/app/views/PlotTabResultUI.js
+++ b/js/app/views/PlotTabResultUI.js
@@ -80,8 +80,11 @@ Ext.define('amdaUI.PlotTabResultUI', {
 		var size = this.getImageSize();
 		// We need a list of parameters to compute the number of points needed to apply FFT
 		this.listParams = panelContext["parameters"];
+		console.log(this.crtContext);
+		zoomPlugin.path_context_file = 'data/' + sessionID + '/RES/' + this.configResult.folder + '/' + "plotFunction0_context.xml";
 		zoomPlugin.setParameters(this.listParams);
 
+
 		var me = this;
 		var insertIntervalItem = null;
 		Ext.each(panelContext.plotArea.axes, function (axis) {
@@ -219,7 +222,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
 			me.contextualMenu.add(insertIntervalItem);
 		}
 		if (plotFunctionItem != null) {
-			me.contextualMenu.insert(0,'-');
+			me.contextualMenu.insert(0, '-');
 			me.contextualMenu.insert(0, plotFunctionItem);
 		}
 	},
@@ -452,7 +455,7 @@ Ext.define('amdaUI.PlotTabResultUI', {
 			ttTotalField.setValue(this.crtContext.page.ttNbIntervals);
 	},
 
-	callInteractivePlot: function (obj) {
+	callInteractivePlot: function (obj, postProcess = () => null) {
 		loadMask.show(true);
 
 		var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
@@ -463,8 +466,10 @@ Ext.define('amdaUI.PlotTabResultUI', {
 			var t = e.getTransaction();
 			if (e.status) {
 				if (result) {
+					console.log(result);
 					if (result.success) {
 						plotModule.updateInteractiveSession(result, false);
+						postProcess();
 					}
 					else
 						myDesktopApp.errorMsg('Interactive action error - ' + result.message);
@@ -689,6 +694,8 @@ Ext.define('amdaUI.PlotTabResultUI', {
 
 	init: function (configResult) {
 		this.crtContext = configResult.context;
+		console.log(configResult);
+		this.configResult = configResult;
 		this.interactiveId = configResult.interactiveId;
 		this.multiplot = (configResult.multiplot == true);
 
--
libgit2 0.21.2