GanttSeriesCollection question

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jweber

GanttSeriesCollection question

Post by jweber » Thu Sep 12, 2002 8:37 pm

Does anyone have any idea why the following won't work?

Calendar cal = Calendar.getInstance();
Date start, end;
GanttSeries jgs = new GanttSeries("Jason");
cal.set(2002,9,12);
start = cal.getTime();
cal.set(2002,10,21);
end = cal.getTime();
jgs.add("SAS Report", new TimeAllocation(start, end));
GanttSeries ngs = new GanttSeries("test");
cal.set(2002,9,10);
start = cal.getTime();
cal.set(2002,10,11);
end = cal.getTime();
ngs.add("Report Request Tool", new TimeAllocation(start, end));

GanttSeriesCollection gsc = new GanttSeriesCollection();

gsc.add(jgs);
gsc.add(ngs);


It errors out right at the last line. It doesn't seem to want to add another GanttSeries to the collection.
I get the following error when I try it:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: -1, Size: 1
at java.util.ArrayList.RangeCheck(ArrayList.java:508)
at java.util.ArrayList.get(ArrayList.java:320)
at com.jrefinery.data.GanttSeries.getTimeAllocation(Unknown Source)
at com.jrefinery.data.GanttSeriesCollection.getStartValue(Unknown Source)
at com.jrefinery.data.DatasetUtilities.getRangeExtent(Unknown Source)
at com.jrefinery.chart.HorizontalCategoryPlot.getHorizontalDataRange(Unknown Source)
at com.jrefinery.chart.HorizontalDateAxis.autoAdjustRange(Unknown Source)
at com.jrefinery.chart.HorizontalDateAxis.configure(Unknown Source)
at com.jrefinery.chart.Axis.setPlot(Unknown Source)
at com.jrefinery.chart.CategoryPlot.<init>(Unknown Source)
at com.jrefinery.chart.HorizontalCategoryPlot.<init>(Unknown Source)
at com.jrefinery.chart.HorizontalCategoryPlot.<init>(Unknown Source)
at com.jrefinery.chart.ChartFactory.createGanttChart(Unknown Source)
at gantt.main(gantt.java:31)


Thanks for any help!

Jas

Locked