Skip to content

Commit f922fa6

Browse files
author
Lijun Zhang
committed
DM-9342:
Fixed the bug introduced that made Bayesian Block fail. Change all the data type of all numberical properties in HistogramOptions PropTypes.oneOfType([PropTypes.string,PropTypes.number])
1 parent 412be80 commit f922fa6

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

src/firefly/java/edu/caltech/ipac/firefly/server/query/HistogramProcessor.java

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class HistogramProcessor extends IpacTablePartProcessor {
5555
private String algorithm = null;// FIXED_SIZE_ALGORITHM;
5656
private int numBins=0;
5757
private double binWidth=0.0;
58-
private String binSelection;
58+
private String binSelection=null;
5959
private String binSize;
6060
private double min = Double.NaN;
6161
private double max = Double.NaN;
@@ -149,7 +149,9 @@ private void getParameters(TableServerRequest tableServerRequest) {
149149
List<Param> params = tableServerRequest.getParams();
150150
for (Param p: params.toArray(new Param[params.size()])){
151151
String name = p.getName();
152+
152153
String value = p.getValue();
154+
if (name==null || value==null ) continue;
153155
if (name.equalsIgnoreCase(COLUMN)) {
154156
//columnName = (String) value;
155157
columnExpression = value;
@@ -174,15 +176,18 @@ else if (name.equalsIgnoreCase(PRESERVE_EMPTY_BIN) ){
174176
}
175177

176178

177-
if (binSelection.equalsIgnoreCase("numBins")){
178-
numBins = Integer.parseInt(binSize);
179-
}
180-
else if (binSelection.equalsIgnoreCase("binWidth") ) {
179+
if (binSelection!=null ){
180+
if (binSelection.equalsIgnoreCase("numBins")) {
181+
182+
numBins = Integer.parseInt(binSize);
183+
}
184+
else if (binSelection.equalsIgnoreCase("binWidth") ) {
181185
binWidth = Double.parseDouble(binSize);
182186

183-
}
184-
if (numBins>0 || binWidth>0.0 ){
185-
algorithm = FIXED_SIZE_ALGORITHM;
187+
}
188+
if (numBins>0 || binWidth>0.0 ){
189+
algorithm = FIXED_SIZE_ALGORITHM;
190+
}
186191
}
187192
}
188193

src/firefly/js/charts/ui/HistogramOptions.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ import {updateSet} from '../../util/WebUtil.js';
1919

2020
export const histogramParamsShape = PropTypes.shape({
2121
algorithm : PropTypes.oneOf(['fixedSizeBins','bayesianBlocks']),
22-
numBins : PropTypes.string,
23-
binWidth : PropTypes.string,
22+
numBins : PropTypes.oneOfType([PropTypes.string,PropTypes.number]),
23+
binWidth :PropTypes.oneOfType([PropTypes.string,PropTypes.number]),
2424
fixedBinSizeSelection : PropTypes.oneOf(['numBins','binWidth']),
25-
falsePositiveRate : PropTypes.string,
26-
minCutoff : PropTypes.string,
27-
maxCutoff : PropTypes.string
25+
falsePositiveRate : PropTypes.oneOfType([PropTypes.string,PropTypes.number]),
26+
minCutoff : PropTypes.oneOfType([PropTypes.string,PropTypes.number]),
27+
maxCutoff :PropTypes.oneOfType([PropTypes.string,PropTypes.number])
2828
});
2929

3030

0 commit comments

Comments
 (0)