I have a timeseries chart plotting data for 1 single day.I set the min and max values for the time axis as 00:00:00 till 23:59:59.I used the below code to set the tick labels for every 4 hours.
XYPlot xyplot = (XYPlot)chart.getPlot(); DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setTickUnit(new DateTickUnit((DateTickUnit.HOUR),4,new SimpleDateFormat("HH:mm")));
However this code is giving me the following tick labels - 3:00,7:00,11:00,15:00,19:00,23:00 It should give 4:00,8:00,12:00,16:00,20:00
Then i changed the code to below :
XYPlot xyplot = (XYPlot)chart.getPlot(); DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setTickUnit(new DateTickUnit((DateTickUnit.MINUTE),240,new SimpleDateFormat("HH:mm")));
This gives the correct tick labels but like this - 3:59,7:59,11:59,15:59,19:59 Again it should give 4:00,8:00,12:00,16:00,20:00
Please suggest what's wrong here.