title: Adding XYChart.Data to XYChart.Series
body: <p>I am trying to plot a waveform in <code>XYChart</code> for a audio file. I have an array of samples. But adding every samples to <code>XYChart.Data</code> and then adding the <code>XYChart.Data</code> to <code>XYChart.Series</code> through a for loop is taking too long even for 2 sec file. Is there any other way where I can add all my values in sample array to <code>Series</code> in one go? Below is my current code:</p>
  
  <pre><code>XYChart.Series&lt;Integer,Double&gt; dataSeries1 = new XYChart.Series&lt;&gt;();
  XYChart.Data&lt;Integer,Double&gt; data = new XYChart.Data&lt;&gt;();
  
  for (int i=0;i&lt;numsamples;i++) {
      data = new XYChart.Data&lt;Integer,Double&gt;( i, samples[i]);
      dataSeries1.getData().add(data);
  }   
  lineChart.getData().clear();
  lineChart.getData().add(dataSeries1);
  </code></pre>