code: public static void writeCSVColumns(XYChart chart, String path2Dir) {
  
      for (XYSeries xySeries : chart.getSeriesMap().values()) {
        writeCSVColumns(xySeries, path2Dir);
      }
    }
docs: Export all XYChart series as columns in separate CSV files.
  
  @param chart
  @param path2Dir