How can I display the names of the days ("Sunday, Monday....") on the time axis, instead of just the date ?
Display days in TimeSeriesChart
Asked Answered
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.
Yes:
DateAxis xAxis = (DateAxis) plot.getDomainAxis();
xAxis.setTickUnit(new DateTickUnit(
DateTickUnit.DAY,
1,
new SimpleDateFormat("EEE", Locale.DE)));
This is a good alternative, but
Locale.getDefault()
might be less locale specific. –
Linnie @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. –
Disharmonious 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.
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". –
Causey © 2022 - 2024 — McMap. All rights reserved.
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". – Causey