gantt chart scroll bar

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
bch

gantt chart scroll bar

Post by bch » Thu Jan 30, 2003 11:17 am

Hello,

I am investigating the Gantt Chart using the JFreeChart library plus the Gantt extensions.

I would like to include a scrollbar in the ChartPanel, so I have added the following code in the constructor:

scrollingGraphPanel = new JScrollPane( this, JScrollPane.VERTICAL_SCROLLBAR_NEVER,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
scrollingGraphPanel.setPreferredSize( new Dimension( width, height ) );

But the horizontal scroll bar does not appear. Could you please tell me why?

Thanks

David Gilbert

Re: gantt chart scroll bar

Post by David Gilbert » Thu Jan 30, 2003 9:21 pm

I think you need to set the preferred size on the ChartPanel, not the JScrollPane.

Regards,

Dave Gilbert

bch

Re: gantt chart scroll bar

Post by bch » Fri Jan 31, 2003 9:47 am

Hello David,

thanks for your response.

I have already done what you say. This is my code in the ChartPanel constructor:

public ChartPanel (.....) {

this.chart = chart;
this.chartMouseListeners = new java.util.ArrayList();
this.chartMouseMotionListeners = new java.util.ArrayList();
this.info = new ChartRenderingInfo();

setPreferredSize(new Dimension(width, height));

//Put the drawing area in a scroll pane.
scrollingGraphPanel = new JScrollPane ( this, JScrollPane.VERTICAL_SCROLLBAR_NEVER, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS );
scrollingGraphPanel.setPreferredSize( new Dimension( width, height ) );
.....
}

I would like to add the Scroll Bar into the "drawing area" where the CategoryItemEntities are drown. Maybe I should try to add it into the plot area.

Thanks in advance,
Belén

Locked