Display days in TimeSeriesChart

♀尐吖头ヾ 提交于 2019-12-11 06:57:51

问题


How can I display the names of the days ("Sunday, Monday....") on the time axis, instead of just the date ?


回答1:


You can use setDateFormatOverride(), as shown here.

Addendum:

isn't there a way to change only the top level?

ChartPanel has methods related to the zoom state. You should be able to set the date format as desired either by overriding the chartChanged() method or in response to user input, as suggested in this example.




回答2:


Yes:

DateAxis xAxis = (DateAxis) plot.getDomainAxis();
xAxis.setTickUnit(new DateTickUnit(
      DateTickUnit.DAY,
      1,
      new SimpleDateFormat("EEE", Locale.DE)));


来源:https://stackoverflow.com/questions/5583757/display-days-in-timeserieschart

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