jFreeChart: DateAxis to behave like a CategoryAxis. Only discrete datevalues to be printed

馋奶兔 提交于 2019-12-01 12:32:41

You can set the TickUnit to any convenient DateTickUnitType. I use DAY in this example and MMM to verify the Locale:

axis.setTickUnit(new DateTickUnit(DateTickUnitType.DAY, 1,
    new SimpleDateFormat("dd.MMM.yy", Locale.GERMAN)));

As you are a returning customer, I'll address the second question, too: setLabelAngle() works perfectly well, but it changes the axis label in the chart legend. Using setVerticalTickLabels() is an alternative for the tick labels themselves:

axis.setVerticalTickLabels(true);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!