don't try to add event icons if x or y is NaN

noticed a bug that's been around since 23.09 -- if trying to plot using an x axis that includes NaN's when there is a flight event, we get an exception trying to position the icon. This checks for NaN's and doesn't plot in that case.
This commit is contained in:
JoePfeiffer 2024-09-24 12:08:21 -06:00
parent 67efd148e5
commit c5fc251c02

View File

@ -327,6 +327,8 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
yName, ycoord, unitY, yName, ycoord, unitY,
sampleIdx) ; sampleIdx) ;
double yloc = slope * ycoord + intercept; double yloc = slope * ycoord + intercept;
if (!Double.isNaN(xcoord) && !Double.isNaN(ycoord)) {
XYImageAnnotation annotation = XYImageAnnotation annotation =
new XYImageAnnotation(xcoord, yloc, image, RectangleAnchor.CENTER); new XYImageAnnotation(xcoord, yloc, image, RectangleAnchor.CENTER);
annotation.setToolTipText(tooltipText); annotation.setToolTipText(tooltipText);
@ -336,6 +338,7 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
} }
} }
} }
}
protected String formatEventTooltip(String dataName, Set<FlightEvent> events, protected String formatEventTooltip(String dataName, Set<FlightEvent> events,
String tName, double time, String unitT, String tName, double time, String unitT,