I'm using JFreeChart 1.0.13 for a research project. I discovered a performance problem while using a large XYTaskDataset in an XYBarChart.
I am trying to make a huge kind of Gantt chart, and if the tasks created have all different descriptions, the chart behaves really slow.
I found a workaround for that, if all the tasks have the same description, it works fine. So I created my own Task class that inherits from Task, and added another field to keep the information I need. Is there a problem if all my tasks have the same description? I played a little bit with the graph and everything seems to work fine, but I am not sure.
Does anybody know why do I have this problem?
Here is the code to create the dataset, containing tasks with the same description.
Thank you.
Regards,
Sofia
createTasks method:
Code: Select all
private TaskSeriesCollection createTasks() {
TaskSeriesCollection localTaskSeriesCollection = new TaskSeriesCollection();
TaskSeries localTaskSeries3;
for (int i = 0; i < 3000; i++) {
localTaskSeries3 = new TaskSeries("Team" + i);
Calendar c = GregorianCalendar.getInstance();
c.setTime(startDate);
c.setTime(new Date());
Date start = c.getTime();
c.add(Calendar.MILLISECOND, 10);
Date end = c.getTime();
Task t = new MyTask("T3a"+i, start, end);
tasks.add(localTaskSeries3);
localTaskSeries3.add(t);
c.add(Calendar.MILLISECOND, 10);
start = c.getTime();
c.add(Calendar.MILLISECOND, 10);
end = c.getTime();
t = new MyTask("T3b"+i, start, end);
localTaskSeries3.add(t);
c.add(Calendar.MILLISECOND, 10);
start = c.getTime();
c.add(Calendar.MILLISECOND, 10);
end = c.getTime();
t = new MyTask("T3c"+i, start, end);
localTaskSeries3.add(t);
localTaskSeriesCollection.add(localTaskSeries3);
}
return localTaskSeriesCollection;
}
Code: Select all
class MyTask extends Task {
private static final long serialVersionUID = -8059327823133382306L;
private String name;
public MyTask(String description, Date start, Date end) {
super("task", start, end);
this.name = description;
// TODO Auto-generated constructor stub
}
public MyTask(String description, TimePeriod duration) {
super("task", duration);
this.name = description;
}
public String getName(){
return name;
}
@Override
public String toString() {
return super.toString() + " " + name;
}
}