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,10 +327,13 @@ public class SimulationPlot extends Plot<FlightDataType, FlightDataBranch, Simul
yName, ycoord, unitY,
sampleIdx) ;
double yloc = slope * ycoord + intercept;
XYImageAnnotation annotation =
new XYImageAnnotation(xcoord, yloc, image, RectangleAnchor.CENTER);
annotation.setToolTipText(tooltipText);
plot.addAnnotation(annotation);
if (!Double.isNaN(xcoord) && !Double.isNaN(ycoord)) {
XYImageAnnotation annotation =
new XYImageAnnotation(xcoord, yloc, image, RectangleAnchor.CENTER);
annotation.setToolTipText(tooltipText);
plot.addAnnotation(annotation);
}
}
}
}