HorizontalDateAxis - Changing the Date Range

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

HorizontalDateAxis - Changing the Date Range

Post by Troy Schrader » Fri May 03, 2002 3:35 pm

Hello,

I am trying to create a Combined Plot containing a High/Low Plot and a Moving Average Plot over a period of time. I place enough data into the DataSet so that it can generate values for the moving average. However, I do not want to display all data values.

For example, I only want to see data on the chart for the past 7 days. However, in order to create a 50-day moving average for those 7 days, I need to insert 50 extra days' worth of data. When it comes time to display the chart, I cannot hide the extra 50 days.

I have tried the following:

HorizontalDateAxis hda = (HorizontalDateAxis)plot.getHorizontalAxis();
hda.setAutoRange(false);
hda.setMinimumDate(new Date(minimumDateString));
hda.setMaximumDate(new Date(maximumDateString));

When I do gets on the min and max dates after setting them, they are still at their original values. How can I get this to work?

Thanks,
Troy

David Gilbert

Re: HorizontalDateAxis - Changing the Date Range

Post by David Gilbert » Fri May 03, 2002 4:36 pm

One of the difficulties of the current combined plot implementation is that there are axes all over the place, and it can be difficult to know which one is in control (I'm still not really sure). I've revised the code quite a lot for the next version of JFreeChart to make this easier to work with. You might want to check out the latest code from CVS on SourceForge.

Regards,

DG

Troy Schrader

Re: HorizontalDateAxis - Changing the Date Range

Post by Troy Schrader » Fri May 03, 2002 5:55 pm

Ok, I'll give that a try.

Thanks,
Troy

Locked