问题
In the gantt chart on my reports I have 1 year's worth of data. I'm only interested in seeing the month printed at the top of the gantt chart. [Jan-Dec]. However, the graph currently displays the Month and the year. How would I customize the chart to just output the month?
回答1:
I'm not sure about JasperReports, but createGanttChart() uses a DateAxis as the range axis. Something like this should work:
DateAxis axis = (DateAxis) plot.getRangeAxis();
axis.setTickUnit(new DateTickUnit(
DateTickUnit.MONTH, 1, new SimpleDateFormat("MMM-yyyy")));
来源:https://stackoverflow.com/questions/7770045/customizing-dates-on-the-gantt-chart-for-jasper-reports