diff --git a/js/app/views/PlotComponents/plotFunction/Histogram.js b/js/app/views/PlotComponents/plotFunction/Histogram.js index 3a3d366..addff8a 100644 --- a/js/app/views/PlotComponents/plotFunction/Histogram.js +++ b/js/app/views/PlotComponents/plotFunction/Histogram.js @@ -1,15 +1,21 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', { - extend: 'amdaPlotComp.plotFunction.BaseComponent', - title: "Histogram Arguments", + extend: 'amdaPlotComp.plotFunction.BaseComponent', // This class extends from amdaPlotComp.plotFunction.BaseComponent + title: "Histogram Arguments", // The title of this component + // Define the IDs for the function, bins, and xMin and xMax fields functionId: 'histo1d-function', binsId: 'histo1d-xbinnumber', xMinId: "histo1d-xmin", xMaxId: 'histo1d-xmax', + /** + * Initializes the component. + * It creates a combo box for selecting the density type and number fields for entering the xMin, xMax, and number of bins. + */ initComponent: function () { const me = this; + // Define combo box store const comboStore = Ext.create('Ext.data.Store', { fields: ['label', 'value'], data: [ @@ -18,6 +24,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', { ] }); + // Create combo box for selecting the density type const densityTypeCombo = Ext.create('Ext.form.field.ComboBox', { fieldLabel: 'Density Type', name: me.functionId, @@ -29,6 +36,7 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', { value: 'density' }); + // Add items to the component Ext.apply(me, { items: [ { @@ -60,9 +68,14 @@ Ext.define('amdaPlotComp.plotFunction.Histogram', { ] }); + // Call the parent class's initComponent method me.callParent(arguments); }, + /** + * Retrieves the selected values from the combo box and number fields. + * Returns an object with properties set to these values. + */ getValues: function () { const densityTypeCombo = this.query('[name=' + this.functionId + ']')[0]; const densityTypeValue = densityTypeCombo.getValue(); -- libgit2 0.21.2