1

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

jzd
  • 23,473
  • 9
  • 54
  • 76
Jannis Alexakis
  • 1,279
  • 4
  • 19
  • 38

2 Answers2

1

Yes:

DateAxis xAxis = (DateAxis) plot.getDomainAxis();
xAxis.setTickUnit(new DateTickUnit(
      DateTickUnit.DAY,
      1,
      new SimpleDateFormat("EEE", Locale.DE)));
Ralph
  • 118,862
  • 56
  • 287
  • 383
  • This is a good alternative, but `Locale.getDefault()` might be less locale specific. – trashgod Apr 07 '11 at 17:16
  • @trashgod: May may not, This strongly depends on our use case. `Local.getDefault()` works in a stand alone appliction, but not on a server. -- Anyway: you are correct in standalone application. – Ralph Apr 08 '11 at 06:27
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.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • After using `setDateFormatOverride()` the axis is always labeled after the SimpleDateFormat i gave it, on every zoom level ; isn´t there a way to change only the top level ? In other words, top level "EEE, dd.MM.yyyy" and further down "HH:mm". – Jannis Alexakis Apr 07 '11 at 18:50