Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#873 Developers Guide no data on CSV import

1.0.x
closed-fixed
David Gilbert
General (896)
5
2008-07-09
2008-07-03
Anonymous
No

Hi,

I recently purchased the Developer's guide for JfreeChart . I wanted to use it mainly to create data sets from CSV files and generate graphs. But the Guide has the following comment on the page it is supposed to explain CSV import.

Chapter 48
Package: org.jfree.data.io
48.1 Introduction
I/O related classes.
48.2 CSV
48.2.1 Overview
To be documented.

Could I get the completed documen or some help in using the CSV class.

I have a code written to take a CSV file but the output graph is incorrect and i am unable to understand how readCategoryDataset() of the CSV classs is handling the data internally.

My code snippet, to draw a line chart by extracting the data from a log file in CSV format with two columns of data, first column to be plotted for Y Axis and the second for X axis:

CSV mcd_log = new CSV();
File file = new File("C:/eclipse/workspace/DataExtraction/res/Data.log");

BufferedReader in = new BufferedReader(new FileReader(file));

CategoryDataset data = mcd_log.readCategoryDataset((java.io.Reader)in);

JFreeChart chart = ChartFactory.createLineChart("MCD Status", "Time", "Eth1 Tx Packets", data, PlotOrientation.VERTICAL, false, true, false);

CategoryPlot plot = (CategoryPlot) chart.getPlot();

LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setShapesVisible(true);
renderer.setFillPaint(Color.white);

ChartFrame frame = new ChartFrame("MCD Status", chart);
frame.pack();
frame.setVisible(true);

Discussion

  • David Gilbert
    David Gilbert
    2008-07-09

    • assigned_to: nobody --> mungady
    • status: open --> closed-fixed