Gantt Chart bug: Subtasks not shown when past date range

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
doofusLARGE
Posts: 11
Joined: Thu Jul 07, 2005 7:40 pm

Gantt Chart bug: Subtasks not shown when past date range

Post by doofusLARGE » Tue Jul 26, 2005 7:57 pm

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.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Jul 26, 2005 8:13 pm

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).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

nsequeira
Posts: 10
Joined: Fri Apr 11, 2003 9:20 pm

Re: Gantt Chart bug: Subtasks not shown when past date range

Post by nsequeira » Tue Jul 26, 2005 8:46 pm

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

doofusLARGE
Posts: 11
Joined: Thu Jul 07, 2005 7:40 pm

Post by doofusLARGE » Wed Jul 27, 2005 2:38 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):

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.

zulfikaralib
Posts: 14
Joined: Thu Sep 22, 2005 5:38 am
Location: Mumbai, India
Contact:

Post by zulfikaralib » Sun Jul 02, 2006 10:55 am

Hi Nathan,

I am also trying to achieve the same thing. Can you please post your code. It would be of great help for me. Thanks in advance.

Awaiting your reply ASAP.
Zulfikarali Barodawala

Locked