How to set the JFreeChart X axis data titles?

倾然丶 夕夏残阳落幕 提交于 2019-12-02 04:03:32
trashgod

ChartFactory.createXYStepChart uses a DateAxis for the domain, so your XYSeries ordinates are interpreted as seconds since the Java epoch. You can either,

  • Use setDateFormatOverride() to format the values as shown here.

  • Use setDomainAxis() on the XYPlot to substitute a NumberAxis for the domain, also suggested here; use integer tick units, as suggested here.

    NumberAxis domain = new NumberAxis(xAxisLabel);
    domain.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    plot.setDomainAxis(domain);
    

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