Commit 5aa4ee37ab0a2a073bd6cfb86123252d8a76211c

Authored by Menouar AZIB
1 parent 9150eb42

Add comments to Histogram.js

Showing 1 changed file with 15 additions and 2 deletions   Show diff stats
js/app/views/PlotComponents/plotFunction/Histogram.js
1 1 Ext.define('amdaPlotComp.plotFunction.Histogram', {
2   - extend: 'amdaPlotComp.plotFunction.BaseComponent',
3   - title: "Histogram Arguments",
  2 + extend: 'amdaPlotComp.plotFunction.BaseComponent', // This class extends from amdaPlotComp.plotFunction.BaseComponent
  3 + title: "Histogram Arguments", // The title of this component
4 4  
  5 + // Define the IDs for the function, bins, and xMin and xMax fields
5 6 functionId: 'histo1d-function',
6 7 binsId: 'histo1d-xbinnumber',
7 8 xMinId: "histo1d-xmin",
8 9 xMaxId: 'histo1d-xmax',
9 10  
  11 + /**
  12 + * Initializes the component.
  13 + * It creates a combo box for selecting the density type and number fields for entering the xMin, xMax, and number of bins.
  14 + */
10 15 initComponent: function () {
11 16 const me = this;
12 17  
  18 + // Define combo box store
13 19 const comboStore = Ext.create('Ext.data.Store', {
14 20 fields: ['label', 'value'],
15 21 data: [
... ... @@ -18,6 +24,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
18 24 ]
19 25 });
20 26  
  27 + // Create combo box for selecting the density type
21 28 const densityTypeCombo = Ext.create('Ext.form.field.ComboBox', {
22 29 fieldLabel: 'Density Type',
23 30 name: me.functionId,
... ... @@ -29,6 +36,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
29 36 value: 'density'
30 37 });
31 38  
  39 + // Add items to the component
32 40 Ext.apply(me, {
33 41 items: [
34 42 {
... ... @@ -60,9 +68,14 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', {
60 68 ]
61 69 });
62 70  
  71 + // Call the parent class's initComponent method
63 72 me.callParent(arguments);
64 73 },
65 74  
  75 + /**
  76 + * Retrieves the selected values from the combo box and number fields.
  77 + * Returns an object with properties set to these values.
  78 + */
66 79 getValues: function () {
67 80 const densityTypeCombo = this.query('[name=' + this.functionId + ']')[0];
68 81 const densityTypeValue = densityTypeCombo.getValue();
... ...