Setting scale in gantt chart

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

Setting scale in gantt chart

Post by Jon Theophilus » Tue Oct 29, 2002 11:56 pm

How would I set the scale to show a year at a time? I don't want the gantt to auto zoom in.

Thanks,
Jon

Dave Gilbert

Re: Setting scale in gantt chart

Post by Dave Gilbert » Wed Oct 30, 2002 9:59 am

Hi Jon,

The axis is an instance of HorizontalDateAxis, and you can set any range you want using the setRange(startDate, endDate) method:

CategoryPlot plot = myGanttChart.getCategoryPlot();
DateAxis axis = (DateAxis) plot.getRangeAxis();
axis.setRange(date1, date2);

...where date1 and date2 are instances of java.util.Date.

Regards,

DG

Locked