dates on x-axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Barry Comer

dates on x-axis

Post by Barry Comer » Tue Feb 04, 2003 7:19 pm

I have a timeseries chart that displays data over a number of
days. The X-axis has a resolution of one hour which cannot change.

Once the timeseries grows beyond three or four days dates are
displayed at the midnight of each day. My question is how can I
change it to display the dates once there is more than one day of
data?

David Gilbert

Re: dates on x-axis

Post by David Gilbert » Thu Feb 06, 2003 4:12 pm

You have two options, both will require a little work:

1) Create your own TickUnits collection and pass it to the setStandardTickUnits(...) method in the DateAxis class. This leaves JFreeChart to "auto-select" the tick unit, you'll need to choose your tick units carefully.

2) Set the tick unit on the axis manually, and update it yourself when the dataset range reaches the required threshold.

Neither of these solutions is ideal, but when it comes to tick labels the transition from one day to multiple days on the axis is not easy to handle...

Regards,

Dave Gilbert

Locked