Package org.knowm.xchart
Class CSVImporter
- java.lang.Object
-
- org.knowm.xchart.CSVImporter
-
public class CSVImporter extends java.lang.ObjectThis class is used to create a Chart object from a folder containing one or more CSV files. The parent folder's name becomes the title of the chart. Each CSV file in the folder becomes a series on the chart. the CSV file's name becomes the series' name.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCSVImporter.DataOrientationstatic classCSVImporter.SeriesData
-
Constructor Summary
Constructors Constructor Description CSVImporter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static java.io.File[]getAllFiles(java.lang.String dirName)This method returns the Files found in the given directoryprivate static java.io.File[]getAllFiles(java.lang.String dirName, java.lang.String regex)This method returns the files found in the given directory matching the given regular expression.private static java.util.List<java.lang.Number>getAxisData(java.lang.String stringData)static XYChartgetChartFromCSVDir(java.lang.String path2Directory, CSVImporter.DataOrientation dataOrientation, int width, int height)static XYChartgetChartFromCSVDir(java.lang.String path2Directory, CSVImporter.DataOrientation dataOrientation, int width, int height, Styler.ChartTheme chartTheme)private static java.lang.String[]getSeriesDataFromCSVColumns(java.io.File csvFile)static CSVImporter.SeriesDatagetSeriesDataFromCSVFile(java.lang.String path2CSVFile, CSVImporter.DataOrientation dataOrientation)private static java.lang.String[]getSeriesDataFromCSVRows(java.io.File csvFile)Get the series's data from a file
-
-
-
Method Detail
-
getChartFromCSVDir
public static XYChart getChartFromCSVDir(java.lang.String path2Directory, CSVImporter.DataOrientation dataOrientation, int width, int height, Styler.ChartTheme chartTheme)
- Parameters:
path2Directory-dataOrientation-width-height-chartTheme-- Returns:
-
getSeriesDataFromCSVFile
public static CSVImporter.SeriesData getSeriesDataFromCSVFile(java.lang.String path2CSVFile, CSVImporter.DataOrientation dataOrientation)
-
getChartFromCSVDir
public static XYChart getChartFromCSVDir(java.lang.String path2Directory, CSVImporter.DataOrientation dataOrientation, int width, int height)
- Parameters:
path2Directory-dataOrientation-width-height-- Returns:
-
getSeriesDataFromCSVRows
private static java.lang.String[] getSeriesDataFromCSVRows(java.io.File csvFile)
Get the series's data from a file- Parameters:
csvFile-- Returns:
-
getSeriesDataFromCSVColumns
private static java.lang.String[] getSeriesDataFromCSVColumns(java.io.File csvFile)
- Parameters:
csvFile-- Returns:
-
getAxisData
private static java.util.List<java.lang.Number> getAxisData(java.lang.String stringData)
- Parameters:
stringData-- Returns:
-
getAllFiles
private static java.io.File[] getAllFiles(java.lang.String dirName, java.lang.String regex)This method returns the files found in the given directory matching the given regular expression.- Parameters:
dirName- - ex. "./path/to/directory/" *make sure you have the '/' on the endregex- - ex. ".*.csv"- Returns:
- File[] - an array of files
-
getAllFiles
private static java.io.File[] getAllFiles(java.lang.String dirName)
This method returns the Files found in the given directory- Parameters:
dirName- - ex. "./path/to/directory/" *make sure you have the '/' on the end- Returns:
- File[] - an array of files
-
-