Problems with Gantt Chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Demati
Posts: 12
Joined: Tue Jan 30, 2007 4:04 pm

Problems with Gantt Chart

Post by Demati » Mon Mar 05, 2007 5:40 pm

I am currently working on a program that will dynamically update a Gantt Chart with reservations. I made a small app to demonstrate the problem I am running into. Sorry for the strange format of the links bellow, but the forum software will not allow me to provide a direct link since I am a newer user of the forum.

h t t p : (slash)(slash)img404(dot)imageshack(dot)us(slash)img404(slash)1838(slash)ganttgp6(dot)jpg

Here you can see only one reservation, which is scheduled. This is the size of the bar that I would like to display per reservation. When a second reservation is added the following occurs:

h t t p : (slash)(slash)img404(dot)imageshack(dot)us(slash)img404(slash)2773(slash)gantt2tm3(dot)jpg

The bar reduces in height. I could see something like this occurring if there were overlapping reservations. As you can see with subsequent reservations the bars continued to diminish in height:

h t t p : (slash)(slash)img404(dot)imageshack(dot)us(slash)img404(slash)4742(slash)gantt3ca8(dot)jpg

Does anyone know why this occurs? I would like for this to occur if there were overlapping reservations. That way two reservations occupying the same table would be offset. Otherwise I want to have a bar of the same size as the first picture above. My app will be continuously adding reservations, and I will be implementing VCR style buttons to look at the chart backwards (see previous reservations in the day) and forwards. My only issue thus far has been the size of the bar. Eventually it diminishes to the point where it is just a line. Is there any way to get around this without extending one of the bar renderers? Any help is greatly appreciated. Thank you.

-George

Demati
Posts: 12
Joined: Tue Jan 30, 2007 4:04 pm

Post by Demati » Tue Mar 06, 2007 4:10 pm

Well I figured out I can extend GanttRenderer and then I overrode the calculateBarWidth() method. I set the bar width to a constant instead of the minimum ratio the BarRenderer class implements. Hope this helps out other people who might have the same issue.

Locked