I\'m trying to create a graph with JFreeChart, however it doesn\'t get the lines right. Instead of connecting the points in the order I put them, it connects the points from
Try this:
final XYSeries data = new XYSeries("data",false);
Using this constructor for XYSeries disables autosort, as defined in the XYSeries API.
Before:

After:

Absent an sscce it's hard to say, but you might try returning DomainOrder.NONE from your implementation of XYDataset. Also, it may help to know what meaning should be given to lines connecting dots in a scatter plot.