Example usage for org.jfree.data.io CSV CSV

List of usage examples for org.jfree.data.io CSV CSV

Introduction

In this page you can find the example usage for org.jfree.data.io CSV CSV.

Prototype

public CSV(char fieldDelimiter, char textDelimiter) 

Source Link

Document

Creates a new reader with the specified field and text delimiters.

Usage

From source file:de.xirp.chart.ChartUtil.java

/**
 * Returns a {@link org.jfree.data.category.CategoryDataset}
 * generated from a CSV {@link java.io.File}.
 * /*w w  w.ja v  a2  s.  c  o m*/
 * @param csvFile
 *            The file to read the values from.
 * @return A <code>CategoryDataset</code> generated from a csv
 *         file.
 * @see org.jfree.data.category.CategoryDataset
 */
public static CategoryDataset getCategoryDatasetFromCSV(File csvFile) {
    CSV csv = new CSV(',', '"');
    CategoryDataset dataset = null;
    try {
        FileReader fr = new FileReader(csvFile);
        dataset = csv.readCategoryDataset(fr);
    } catch (FileNotFoundException e) {
        logClass.error("Error: " + e.getMessage() //$NON-NLS-1$
                + Constants.LINE_SEPARATOR, e);
    } catch (IOException e) {
        logClass.error("Error: " + e.getMessage() //$NON-NLS-1$
                + Constants.LINE_SEPARATOR, e);
    }
    return dataset;
}