Hi
I have created a TimeSeriesChart via the factory, that contains a serie of values created by
new Minute(some_time, some_value)
The value serie is created by
new BasicTimeSeries("Indoor", Minute.class)
as I have temperature readings for each minut during 24h.
However, I don't want the x-axis label to be of the format hh:mm, I'd rather have just hh. To achieve this, I tried
((DateAxis)((XYPlot)(chart.getPlot())).getHorizontalValueAxis()).setTickUnit(new DateTickUnit(DateTickUnit.HOUR,1));
Now the strange thing, hours are not displayed on the x-axis, instead I get yyyy-mm-dd, why? And how should I correct it?
DateTickUnit and label format in TimeSeriesChart
Re: DateTickUnit and label format in TimeSeriesChart
Fixed the problem by using the constructor of DateTickUnit that takes a java.text.DateFormat as well, but why the odd behaviour when using the simpler constructor? Should not HOUR give HH as default?
Re: DateTickUnit and label format in TimeSeriesChart
The simple constructor just uses:
DateFormat.getDateInstance(DateFormat.SHORT)
...for the date format. For one hour, 'HH' makes sense, but what about 12 hours (where perhaps the chart displays five days of data at half day intervals)? It's just not easy to provide a sensible default for all cases, so I didn't try.
Regards,
Dave Gilbert
DateFormat.getDateInstance(DateFormat.SHORT)
...for the date format. For one hour, 'HH' makes sense, but what about 12 hours (where perhaps the chart displays five days of data at half day intervals)? It's just not easy to provide a sensible default for all cases, so I didn't try.
Regards,
Dave Gilbert