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
gantt chart scroll bar
Re: gantt chart scroll bar
I think you need to set the preferred size on the ChartPanel, not the JScrollPane.
Regards,
Dave Gilbert
Regards,
Dave Gilbert
Re: gantt chart scroll bar
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
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