Question about DateAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
MNusinov
Posts: 15
Joined: Tue Jul 03, 2007 7:41 pm

Question about DateAxis

Post by MNusinov » Thu Jul 05, 2007 10:27 pm

I appologize if this has been answered before but I need an answer. I'm making a TimeSeriesChart that keeps track of 3 days worth of data that comes in 8 hour increments (So 9 data points at a time) I have everything working except for the Domain axis:

Code: Select all

timeChart.getXYPlot().getDomainAxis().setFixedAutoRange(259200000);  //3 Days
((DateAxis)timeChart.getXYPlot().getDomainAxis()).setTickUnit(new DateTickUnit(DateTickUnit.HOUR, 8, new SimpleDateFormat("dd - HH")));
The following sets it to always display 3 days worth on the axis at a time, so that the tick intervals are in 8 hour ticks. The only problem is, as data is entered into the graph the axis shifts a little bit and instead of having the tick marks at 0 hours, 8 hours, 16 hours, etc. They're at 7 hours, 15 hours, 23 hours, etc. Is there a way to force the tick marks to always be at 0, 8, 16, 0, 8, 16 etc. I understand that at times the axis would start at the 8 tick or the 16 tick, but I don't want it to shift them to odd numbers.

Any help or suggestions would very much be appreciated. Thanks.

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Thu Jul 05, 2007 10:48 pm

This problem may be related to this bug http://www.jfree.org/phpBB2/viewtopic.php?t=20993

MNusinov
Posts: 15
Joined: Tue Jul 03, 2007 7:41 pm

Post by MNusinov » Fri Jul 06, 2007 2:02 pm

That appears to be very similar. I'll take a look at trying to fix that.

Locked