title: JavaFX Category Axis for XYChart is not in data order
body: <p>I have a problem where when I add data to a category axis and the axis titles have been used before, the order gets screwed up.  Run the simple app below and click twice on the graph and look at the x axis to see what I mean. The data is supplied to the graph from month 0 to 10 but displayed in another order. Any Help?</p>
  
  <pre><code>package testCategoryBug;
  
  import javafx.application.Application;
  import javafx.collections.FXCollections;
  import javafx.collections.ObservableList;
  import javafx.event.EventHandler;
  import javafx.scene.chart.CategoryAxis;
  import javafx.scene.chart.NumberAxis;
  import javafx.scene.chart.XYChart;
  import javafx.stage.Stage;
  import javafx.scene.Scene;
  import javafx.scene.chart.LineChart;
  import javafx.scene.chart.XYChart.Data;
  import javafx.scene.chart.XYChart.Series;
  import javafx.scene.input.MouseEvent;
  
  public class TestCategoryBug extends Application {
      static Boolean even=true;
      @Override public void start(Stage stage) {
          stage.setTitle("Test Category Bug");    
          final CategoryAxis xAxis = new CategoryAxis();
          final NumberAxis yAxis = new NumberAxis();
          xAxis.setLabel("Month");       
  
          final LineChart&lt;String,Number&gt; lineChart = new LineChart&lt;String,Number&gt;(xAxis, yAxis);       
          lineChart.setTitle("Stock Monitoring, 2010");     
  
          // Initialize some data for plotting.
          final Series&lt;String, Number&gt; plottablePairs  = new Series&lt;String, Number&gt;();
          final Series&lt;String, Number&gt; plottablePairs2 = new Series&lt;String, Number&gt;();
          for (int i = 0; i &lt; 10; i++) {
              Data&lt;String,Number&gt; pair= new Data&lt;String,Number&gt;("Month "+i,10.0*i);
              plottablePairs.getData().add(pair);
          }
          for (int i = 5; i &lt; 10; i++) {
              Data&lt;String,Number&gt; pair= new Data&lt;String,Number&gt;("Month "+i,100.0-10*i);
              plottablePairs2.getData().add(pair);
          }
  
          // add the first of the series
          final ObservableList&lt;XYChart.Series&lt;String, Number&gt;&gt; chartData=FXCollections.observableArrayList();;
          chartData.add(plottablePairs);
          lineChart.setData(chartData);
  
          // now on a mouse click, swap the data.  Click twice and see what happens
          lineChart.addEventHandler(MouseEvent.MOUSE_CLICKED,new EventHandler&lt;MouseEvent&gt;() {
              @Override
              public void handle(MouseEvent e) {
                  chartData.clear();
                  if (even) {
                      chartData.add(plottablePairs2);
                  } else {
                      chartData.add(plottablePairs);
                      // note that after this, the axis is screwed up.
                  }
                  lineChart.setData(chartData);
                  even=!even;
              }
          });
  
          // Put up the scene
          Scene scene  = new Scene(lineChart,800,600);
          stage.setScene(scene);
          stage.show();
      }
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>