Commit 7587a677c79e2158ee6d29a46eeb2d49c6e9f307
1 parent
aba2eb97
Exists in
master
and in
16 other branches
Delete unused files and cleaning
Showing
3 changed files
with
2 additions
and
325 deletions
Show diff stats
js/app/views/PlotComponents/plotFunction/CreatePlot.js deleted
... | ... | @@ -1,195 +0,0 @@ |
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 | -}); | |
196 | 0 | \ No newline at end of file |
js/app/views/PlotComponents/plotFunction/FunctionType.js
... | ... | @@ -96,11 +96,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
96 | 96 | initComponent: function () { |
97 | 97 | this.view = Ext.create('Ext.form.FieldSet', { |
98 | 98 | collapsible: false, |
99 | - layout: { | |
100 | - type: 'vbox', | |
101 | - pack: 'start', | |
102 | - align: 'stretch', | |
103 | - }, | |
99 | + layout: LAYOUT_STYLE, | |
104 | 100 | bodyStyle: 'background: none', |
105 | 101 | items: [this.createFunctionComboBox(), this.createAxisComboBox(this.x_axis), this.createAxisComboBox(this.y_axis)] |
106 | 102 | }); |
... | ... | @@ -135,7 +131,7 @@ Ext.define('amdaPlotComp.plotFunction.FunctionType', { |
135 | 131 | // Adding values to out |
136 | 132 | Object.assign(out, values); |
137 | 133 | } |
138 | - | |
134 | + | |
139 | 135 | return out; |
140 | 136 | } |
141 | 137 | }); |
142 | 138 | \ No newline at end of file |
... | ... |
js/app/views/PlotComponents/plotFunction/ParamField.js deleted
... | ... | @@ -1,124 +0,0 @@ |
1 | -/** | |
2 | - * Un composant de 'PlotFunction' qui permet d'afficher le min samplig de chaque paramètre et le nombre de points théoriques entre un start time et stop time | |
3 | - */ | |
4 | -Ext.define('amdaPlotComp.plotFunction.ParamField', { | |
5 | - extend: 'Ext.form.Panel', | |
6 | - /** | |
7 | - * id du composant de type numberfield qui hébérge le min sampling | |
8 | - */ | |
9 | - label_number_field: "NUMBERFIELD", | |
10 | - /** | |
11 | - * id du composant de type numberfield qui hébérge le nombre de points | |
12 | - */ | |
13 | - label_number_field1: "NUMBERFIELD1", | |
14 | - /** | |
15 | - * Le composant parent de celui-ci | |
16 | - */ | |
17 | - parent: null, | |
18 | - | |
19 | - initComponent: function () { | |
20 | - const items_params = []; | |
21 | - const minSampling = "Sampling Time (s)"; | |
22 | - const minValue = 0; | |
23 | - const labelWitdh = 120; | |
24 | - const width = 30; | |
25 | - | |
26 | - for (p in this.params) { | |
27 | - const param = this.params[p]; | |
28 | - const fieldSet = { | |
29 | - xtype: 'fieldset', | |
30 | - name: 'FIELDSET' + param.id, | |
31 | - title: param.id, | |
32 | - collapsible: false, | |
33 | - layout: { | |
34 | - type: 'vbox', | |
35 | - align: 'stretch', | |
36 | - }, | |
37 | - items: [ | |
38 | - { | |
39 | - xtype: 'numberfield', | |
40 | - name: this.label_number_field + param.id, | |
41 | - labelWidth: labelWitdh, | |
42 | - width: width, | |
43 | - value: param.MinSampling, | |
44 | - minValue: minValue, | |
45 | - disabled: true, | |
46 | - fieldLabel: minSampling | |
47 | - }, | |
48 | - { | |
49 | - xtype: 'numberfield', | |
50 | - name: this.label_number_field1 + param.id, | |
51 | - labelWidth: labelWitdh, | |
52 | - width: width, | |
53 | - value: 0, | |
54 | - minValue: minValue, | |
55 | - fieldLabel: "Nb Points" | |
56 | - } | |
57 | - ] | |
58 | - }; | |
59 | - | |
60 | - items_params.push(fieldSet); | |
61 | - } | |
62 | - | |
63 | - const tabParams = Ext.create('Ext.tab.Panel', { | |
64 | - layout: 'fit', | |
65 | - plain: true, | |
66 | - bodyStyle: 'background: none', | |
67 | - items: items_params | |
68 | - }); | |
69 | - | |
70 | - const config = | |
71 | - { | |
72 | - title: 'Parameters Sampling', | |
73 | - layout: 'fit', | |
74 | - bodyStyle: { background: '#dfe8f6' }, | |
75 | - items: [tabParams] | |
76 | - }; | |
77 | - | |
78 | - Ext.apply(this, config); | |
79 | - //Les arguments sont les paramètres, chaque paramètre contient un id et un min Sampling | |
80 | - this.callParent(arguments); | |
81 | - }, | |
82 | - | |
83 | - /** | |
84 | - * Set parent | |
85 | - * @param {*} parent_ le parent qui contient ce composant | |
86 | - */ | |
87 | - setParent: function (parent_) { | |
88 | - this.parent = parent_; | |
89 | - }, | |
90 | - | |
91 | - /** | |
92 | - * Retourne les valeurs d'id, min sampling et nb_points de tout les parametres passés comme argument | |
93 | - * @returns id1@minSampling1@nb_points1@id2@minSampling2@nb_points2.... | |
94 | - */ | |
95 | - getValues: function () { | |
96 | - let list = ""; | |
97 | - const delimeter = "@"; | |
98 | - let i = 0; | |
99 | - for (p in this.params) { | |
100 | - let param = this.params[p]; | |
101 | - const ui_item = this.parent.findField(this.label_number_field1 + param.id); | |
102 | - if (i > 0) list += delimeter; | |
103 | - if (ui_item !== undefined && ui_item !== null) { | |
104 | - list += param.id + delimeter + param.MinSampling + delimeter + ui_item.getValue() + delimeter + "5"; | |
105 | - } | |
106 | - i++; | |
107 | - } | |
108 | - return { "param_nb_points": list }; | |
109 | - }, | |
110 | - | |
111 | - /** | |
112 | - * Mettre à jour le nb_points en fonction de la valeur de start time et stop time passés en paramètres | |
113 | - * @param {*} startTime le start time issu du ZoomPlugin | |
114 | - * @param {*} stopTime le stop time issu du ZoomPlugin | |
115 | - */ | |
116 | - setValues: function (startTime, stopTime) { | |
117 | - for (p in this.params) { | |
118 | - let param = this.params[p]; | |
119 | - const nb_points = (stopTime.getTime() - startTime.getTime()) / (1000. * param.MinSampling); | |
120 | - const ui_item = this.parent.findField(this.label_number_field1 + param.id); | |
121 | - ui_item.setValue(parseInt(nb_points)); | |
122 | - } | |
123 | - } | |
124 | -}); |