I've been using NaNs in series to represent where I don't have data on the X axis, but if the series starts with NaN, an extra point appears at the start.
This sample should show one point at (2.0, 1.0), but an extra point appears at (1.0, 1.0):
import org.knowm.xchart.QuickChart;
import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.XYChart;
import org.knowm.xchart.style.markers.Circle;
public class Bug {
public static void main(String[] args) throws Exception {
double[] xData = new double[] { 1.0, 2.0 };
double[] yData = new double[] { Double.NaN, 1.0 };
// Create Chart
XYChart chart = QuickChart.getChart("Sample Chart", "X", "Y", "1", xData, yData);
chart.getSeriesMap().get("1").setMarker(new Circle());
// Show it
new SwingWrapper(chart).displayChart();
}
}
Changing PlotContent_XY:107 from if (next == NaN) to if (Double.isNaN(next)) seems to fix the problem.
I've been using NaNs in series to represent where I don't have data on the X axis, but if the series starts with NaN, an extra point appears at the start.
This sample should show one point at (2.0, 1.0), but an extra point appears at (1.0, 1.0):
Changing
PlotContent_XY:107fromif (next == NaN)toif (Double.isNaN(next))seems to fix the problem.