Jannis Alexakis
Jannis Alexakis

Reputation: 1319

Display days in TimeSeriesChart

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

Upvotes: 1

Views: 842

Answers (2)

trashgod
trashgod

Reputation: 205785

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.

Upvotes: 1

Ralph
Ralph

Reputation: 120771

Yes:

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

Upvotes: 1

Related Questions