Jfreechart: Display weeks on x axis for value of days

后端 未结 1 621
旧时难觅i
旧时难觅i 2021-01-24 08:36

I am using JFreeChart to display a value for each day of a month. Now I want to have my x-axis display the weeks in a month instead of the days. At the moment the values for my

相关标签:
1条回答
  • 2021-01-24 09:21

    You should use a DateAxis for your time axis, like ChartFactory.createTimeSeriesChart() does. Then you can use setDateFormatOverride(), like they show here, and the SimpleDateFormat for "week in month."

    JFreeChart chart = ChartFactory.createTimeSeriesChart(…);
    DateAxis axis = (DateAxis) chart.getXYPlot().getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("W"));
    
    0 讨论(0)
提交回复
热议问题