problem with creating line chart using array

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
thunderforge
Posts: 5
Joined: Sat Aug 16, 2008 5:25 am

problem with creating line chart using array

Post by thunderforge » Sat Sep 27, 2008 1:46 am

hey all,

i got some problem with drawing a chart for RSI. I read in some data from "out.txt" and wanted to plot them against "month", which will increase by itself. The problem is for setting the month into the dataset:

try {
File f = new File("out.txt");
Scanner input = new Scanner(f);

while (input.hasNextLine()) {

data = input.nextDouble();
i++;
}
}

catch (IOException ex) {
System.err.println(ex);
}

for(y=0;y<=233;y++) {

date[y] = DateUtilities.createDate(2007, sep, 3+y, 12, 0);
dataset.addValue(data[y], "Classes", date[y]);

}

I cant use date[y] in that part, it is suppose to be a comparable. Please help!! BTW, i bought the developer guide already but abit bulky for this.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Post by paradoxoff » Sat Sep 27, 2008 9:46 am

It looks like you are using a DefaultCategoryDataset and a CategoryPlot. Maybe an XYPlot with a DateAxis as DomainAxis would do a better job.

thunderforge
Posts: 5
Joined: Sat Aug 16, 2008 5:25 am

Post by thunderforge » Sun Sep 28, 2008 5:23 am

hmm, let me try it out first, thanks for the suggestions though..appreciated

Locked