I've found a minor (but important) bug in the Gantt Chart: When a subtask is added that has a date out of range of any other regular, non-subtask task, it fails to appear. The timeline scale isn't made wide enough to include this subtask.
Does anyone know where I could go (what class) to address the problem? I'm already substantially involved in the editing of the gantt chart classes, so I'm hoping I could fix it myself.
Thanks.
Gantt Chart bug: Subtasks not shown when past date range
-
- Posts: 11
- Joined: Thu Jul 07, 2005 7:40 pm
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
In theory, a subtask should fit within the duration of the task it belongs to. In practice, that probably isn't enforced.
The axis range is getting set to the range returned by the findRangeBounds() method in the DatasetUtilities class. This relies on the dataset having implemented the IntervalCategoryDataset interface, and the methods in this interface as implemented by the TaskSeriesCollection only look at the task durations, not the subtask durations (which were assumed to fall within the task duration).
The axis range is getting set to the range returned by the findRangeBounds() method in the DatasetUtilities class. This relies on the dataset having implemented the IntervalCategoryDataset interface, and the methods in this interface as implemented by the TaskSeriesCollection only look at the task durations, not the subtask durations (which were assumed to fall within the task duration).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Gantt Chart bug: Subtasks not shown when past date range
Am I missing something? I haven't been able to get subtasks to get rendered at all! Both Gantt chart demos show very simple task data sets with no subtasks. What is the support for subtasks? FYI, I'm using v1.0 rc1. Thanks.
-- Nathan
-- Nathan
-
- Posts: 11
- Joined: Thu Jul 07, 2005 7:40 pm
David-
I guess that makes sense. Thanks for the help. To suite my needs, I changed the method getEndValue in TaskSeriesCollection like this (new code between /** ***/ comments):
This seems to work fine.
Nathan-
Post some code and we can find out what you're doing wrong. Subtasks work just fine.
I guess that makes sense. Thanks for the help. To suite my needs, I changed the method getEndValue in TaskSeriesCollection like this (new code between /** ***/ comments):
Code: Select all
public Number getEndValue(Comparable rowKey, Comparable columnKey) {
Number result = null;
int row = getRowIndex(rowKey);
TaskSeries series = (TaskSeries) this.data.get(row);
Task task = series.get(columnKey.toString());
if (task != null) {
TimePeriod duration = task.getDuration();
result = new Long(duration.getEnd().getTime());
/*** Begin added code ***/
for (int i = 0; i < task.getSubtaskCount(); i++){
duration = task.getSubtask(i).getDuration();
Number tmp = new Long(duration.getEnd().getTime());
if (tmp.longValue() > result.longValue())
result = tmp;
}
/*** End added code ***/
}
return result;
}
This seems to work fine.
Nathan-
Post some code and we can find out what you're doing wrong. Subtasks work just fine.
-
- Posts: 14
- Joined: Thu Sep 22, 2005 5:38 am
- Location: Mumbai, India
- Contact: