The data points will usually be connected in the order that they are listed in the Data Editor. However, you can also connect them in the order of their x-coordinates. To do this, open up the Graph Properties and, in the General pane, check the Sort Data box.
Warning: Do not use PopUp text when you've selected Sort Data. PopUp text will not work correctly.