Two Java plot fixes (#665)

* MinY and MaxY of Plot axis should never be the same, even with flatline data.

* In addition to a null check, add a empty units String check.
This commit is contained in:
jmpenn 2018-09-06 14:46:08 -05:00 committed by GitHub
parent c112290265
commit fcbd99aaf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -323,7 +323,8 @@ public abstract class DataReader {
varData = varData + theVar.getBias().doubleValue();
}
if (theVar.getUnits() != null) {
String theUnits = theVar.getUnits();
if ((theUnits != null) && (theUnits != "")) {
varData = convertUnits(varData, getLogVar(theVar.getName()), theVar);
}

View File

@ -112,6 +112,11 @@ public class TrickXYPlot extends XYPlot {
maxY = Math.max(maxY, dataset.getSeries(i).getMaxY());
}
guiXAxis.setRange(minX, maxX);
if (minY == maxY) {
minY -= 1.0;
maxY += 1.0;
}
guiYAxis.setRange(minY, maxY);
}