org.jfree.chart.renderer.xy.StandardXYItemRenderer.drawItem() attempts to draw a line between the current and previous data points. However, it only looks back 1 data point. This fails if there is no Y data for every X value in the dataset. In my case, I am graphing data from separate log files, where the timestamps (x values) may not line up because the logging processes started at different times.
Instead of looking back only 1 item, it should look back until if finds a valid value, if one exists. The following code (line 888 in 1.0.13):
// get the previous data point...
double x0 = dataset.getXValue(series, item - 1);
double y0 = dataset.getYValue(series, item - 1);
should be changed to:
int n = 1;
double x0 = 0;
double y0 = 0;
// continue until both x0 and y0 are not NaN or there is no previous data
x0 = dataset.getXValue(series, item - n);
y0 = dataset.getYValue(series, item - n);
while ((n <= item) && (Double.isNaN(x0) || Double.isNaN(y0)));
Note that if no valid valid exists, the later NaN check will catch it.
This fix could have performance implications, but they should be minimal for a normal, non-sparse dataset. Even in the sparse case, there will should be data within a few points of the current item. The main issues would be on a very large (thousands of data points?) datasets with very sparse data; I think this may be an uncommon case.