DomainAxis changing values

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

DomainAxis changing values

Post by Mark Perez » Wed Dec 04, 2002 9:43 pm

I created a line graph that displays data over 5 days. When the window first loads the vategory values is displayed as a date(mm/dd/yyyy), but when I maximize the window is repaints the values in hours. Displaying it in hours makes it confusing when the graph spans multiple days. Is there a way I can have the date be displayed along with the hour, perhaps on the same line or even better if I can use markers. Any ideas how I can accomplish?

David Gilbert

Re: DomainAxis changing values

Post by David Gilbert » Thu Dec 05, 2002 12:05 am

Including the date in the hour formatting looks wrong for intraday charts, but not including the date for multi day charts looks wrong too. I've made the default work for intraday charts...so you'll need to modify the formatting for your chart. Here's what to do:

In the DateAxis class, there is a method createStandardDateTickUnits(). Copy this method to somewhere in your own code, and alter the date formats as you see fit (you can remove any units that you won't require). Now you can call the setStandardTickUnits(...) method (it is defined in the ValueAxis class) on your date axis to install your new collection, along with the revised formatting.

Regards,

DG

Mark Perez

Re: DomainAxis changing values

Post by Mark Perez » Thu Dec 05, 2002 12:37 am

I will give that a try, thanks for the detailed and very quick response.

Mark Perez

Re: DomainAxis changing values

Post by Mark Perez » Fri Dec 06, 2002 3:16 am

Assuming i have a graph that show 3 days, it would be great if we could get the graph to display in hour intervals (maybe every 6 hours) and then at each x axis that marked a new date display a category with that date. Something like this:

1 1 2 4 1
6 2 8 4 / 6 2
: : : : 2 : :
0 0 0 0 8 0 0
0 0 0 0 / 0 0
2
0
0
2

Is there a way i can do this with the current methods(maybe using markers?) or do i need to develop something entirely new?

David Gilbert

Re: DomainAxis changing values

Post by David Gilbert » Mon Dec 09, 2002 11:23 pm

Hi Mark,

You would need to modify the date axes to support this. I understand the requirement, so it is on the to-do list (but that list is very long!).

Regards,

DG

Locked