Gantt Chart - Task with a Null duration.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
bto
Posts: 5
Joined: Mon Mar 14, 2005 4:30 am

Gantt Chart - Task with a Null duration.

Post by bto » Tue Jul 12, 2005 9:04 am

I have created a Gantt chart and I draw to my panel, a series of Tasks (horizontal bar lines) all with set individual durations. However, there are some tasks that will not have a duration but I still wish to show it on the panel as another horizontal line entry.

Is there any way of achieving this?
- If I set the duration to be something completely out of range, then the ChartPanel will still try and draw that task.
- If I set the duration to null, I get a NullPointerException.

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 12, 2005 10:25 am

The NullPointerException is a bug - I've fixed it in CVS ready for the next release. Thanks for the report.
David Gilbert
JFreeChart Project Leader

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

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

Post by doofusLARGE » Tue Jul 12, 2005 2:47 pm

I also wanted to show singe date 'milestones', as well as lines between tasks that were dependent on each other. Here's what I did:

I modified GanttRenderer.java, Task.java, TaskSeriesCollection.java, and GanttCategoryDataset.java appropriately, and also created my own class called Milestone.java. In the drawTask method in GanttRenderer, all of the drawing is done, and in your case I think you can just add a simple if statement and then draw a oval or something to show the event.

Let me know if this helps.

bto
Posts: 5
Joined: Mon Mar 14, 2005 4:30 am

Post by bto » Wed Jul 13, 2005 1:23 am

Thanks for your replies guys.

David, so with the null pointer exception fixed, does that mean that we can specify Task.setDuration(null) and this will just not draw anything on the Gantt chart? Also, would it be possible to obtain this modification? I'm working on a project which has links to an older version of the jFreechart library, and I dont want to update the .jar file because I know it would probably break stuff (and people will get annoyed with me!)

doofusLarge, if I create a derived class from the GanttRenderer, I'm not quite sure how to implement the drawTask method. Have you got any hints on how to do that, and all the parameters required for it?

Brendon.

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 » Wed Jul 13, 2005 2:15 pm

David Gilbert
JFreeChart Project Leader

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

bto
Posts: 5
Joined: Mon Mar 14, 2005 4:30 am

Post by bto » Mon Jul 18, 2005 1:17 am

Would you have any indication when the next release would be that would fix this exception? Is there any chance of getting a .jar build in the meantime?

Thanks for your help!
Brendon.

Silenius
Posts: 4
Joined: Mon Oct 02, 2006 6:32 pm
Contact:

Post by Silenius » Mon Oct 02, 2006 6:38 pm

doofusLARGE wrote:I also wanted to show singe date 'milestones', as well as lines between tasks that were dependent on each other. Here's what I did:

I modified GanttRenderer.java, Task.java, TaskSeriesCollection.java, and GanttCategoryDataset.java appropriately, and also created my own class called Milestone.java. In the drawTask method in GanttRenderer, all of the drawing is done, and in your case I think you can just add a simple if statement and then draw a oval or something to show the event.

Let me know if this helps.
I need to make the same modifications you did.
Can you please give me more info on how to do that?

Locked