title: JavaFX LineChart - clean data from chart
body: <p>i have problem with remove data from line chart. I wrote a program drawing graphs that after the action click on the button completes the chart data.</p>
  
  <p>dataSeries1.getData().removeAll(); &lt;- doesn't work.</p>
  
  <p>Code:</p>
  
  <pre><code> NumberAxis xAxis = new NumberAxis();
      xAxis.setLabel("Oś Y");
      NumberAxis yAxis = new NumberAxis();
      yAxis.setLabel("Oś X");
      final LineChart lineChart = new LineChart(xAxis, yAxis);
      final XYChart.Series dataSeries1 = new XYChart.Series();
  
      lineChart.setCreateSymbols(false);
      lineChart.getData().add(dataSeries1);
  </code></pre>
  
  <p>Button action: </p>
  
  <pre><code> btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
          @Override
          public void handle(ActionEvent event) {
  
              int lewy = Integer.parseInt(kresLewy.getText());
              int prawy = Integer.parseInt(kresPrawy.getText());
              String rownanie = field.getText();
  
              try {
  
                  String tekst = lewy + "; " + prawy + "; " + rownanie;
  
                  StringReader tekstReader = new StringReader(tekst);
  
                  parsery.interpreter.parser parser_obj
                          = new parsery.interpreter.parser(new parsery.interpreter.MyLexer(tekstReader));
  
                  Object result = parser_obj.parse().value;
  
                  String sWynik = result.toString();
  
                  ZmiennaX zX = new ZmiennaX();
                  ArrayList&lt;Double&gt; xArr = new ArrayList&lt;Double&gt;();
                  for (double i = lewy; i &lt;= prawy + 0.001; i = i + zX.getDokladnosc()) // +0.001 dla bledow zaokraglenia
                  {
                      xArr.add(zX.round2(i));
                  }
                  String sX = xArr.toString();
                  String wartosciX = sX.substring(1, sX.length() - 1);
                  String wartosciY = sWynik.substring(1, sWynik.length() - 1);
  
                  String XbezSpacji = wartosciX.replace(" ", "");
                  String YbezSpacji = wartosciY.replace(" ", "");
  
                  String[] splitX = XbezSpacji.split(",");
                  String[] splitY = YbezSpacji.split(",");
                  dataSeries1.getData().removeAll();
  
                  for(int i=0; i&lt;splitX.length; i++){
                  double x = Double.parseDouble(splitX[i]);
                  double y = Double.parseDouble(splitY[i]);
                  dataSeries1.getData().add(new XYChart.Data(x, y));
                  }
  
              } catch (Exception e) {
                  System.out.println("Podczs obliczenia wystapil blad. (" + e.getMessage() + ")");
              } catch (Error error) {
                  System.out.println("Podczs obliczenia wystapil blad. (" + error.getMessage() + ")");
              }
          }
      });
  </code></pre>
  
  <p>Can anyone help me to remove data after drawing a new chart?</p>