Non-Liner Date Axis

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

Non-Liner Date Axis

Post by Mubashar Iqbal » Wed Mar 14, 2001 4:06 am

Is it possible to have a DateAxis that is non linear in nature?

That is I only want to display values for dates that are in the DataSet not all those are are between and minimum, and maximum date.

Thanks in Advance,
Mubashar Iqbal
--
miqbal@geocities.com

David Gilbert

RE: Non-Liner Date Axis

Post by David Gilbert » Thu Mar 15, 2001 1:34 pm

Hi Mubashar,

This is not possible at present. However, I have a similar requirement, so it will get implemented at some point (I can't make any promises about when though!).

I need to be able to display interest rate yield curves, which typically have data points at 1, 7, 30, 60, 90 and 180 days, then 1, 2, 3, 4, 5, 7, 10, 15 and 20 years, and I want to be able to display ticks only at those points.

What I'll probably do is modify the axis code so that a set of custom ticks can be specified so that you can choose irregular ticks that don't even necessarily match your datasource. But also I'll implement a method to create a set of custom ticks from a specific data source, so that it is easy to get custom ticks that exactly match the data source.

All this will be optional - you can still use the existing auto-ticks if that works OK (which it does quite often).

Regards,

DG.

David Gilbert

RE: Non-Liner Date Axis

Post by David Gilbert » Thu Mar 15, 2001 1:50 pm

I've registered this as a Feature Request on SourceForge (http://sourceforge.net/projects/jfreechart) with id=408766. This will prevent me from forgetting about it!

Regards,

DG.

Jim Sarne

Post by Jim Sarne » Tue Mar 18, 2003 6:57 pm

Was anything ever done on this? The related feature request on sourceforge has no updates, and I couldn't find anything related in the user's guide or Javadocs. I have a need for non-linear / custom numeric range axes similar to what is discussed here. Example: a range of 0-99 but expanded between 35 and 65. Something like this:

Code: Select all

0     35          43               57          65     99
Suggestions on how to implement this myself are also welcome.

This is a great library - would love to use it. This seems to be the biggest hurdle I've found so far...
- Jim
jsarne87@netscape.net

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Mar 19, 2003 12:00 am

Jim Sarne wrote:Was anything ever done on this? The related feature request on sourceforge has no updates, and I couldn't find anything related in the user's guide or Javadocs. I have a need for non-linear / custom numeric range axes similar to what is discussed here.

<snip>

Suggestions on how to implement this myself are also welcome.
Nothing yet, but here are some hints:

The key methods are defined (but not implemented) in the ValueAxis class:

Code: Select all

public abstract double translateValueToJava2D(double dataValue, Rectangle2D dataArea);
public abstract double translateJava2DtoValue(float java2DValue, Rectangle2D dataArea);
The renderers will use only these methods to work out where to draw data items. You can subclass ValueAxis and implement these methods to perform a non-linear translation. Everything else is just labelling...

Regards,

Dave Gilbert

Bavo
Posts: 3
Joined: Tue Jul 11, 2006 3:06 pm

Post by Bavo » Tue Jul 11, 2006 3:16 pm

Well, this could be my answer :)

I need just the same thing, a graph that autoranges on the minimum and maximumvalues, and an inclusion of 0. The 0 should be just below the minimum range, not linear with the scale.

like:

Code: Select all

0  1.8   1.9   2.0
Is it implemented now? This is an urgent feature, we already bought the developer guide.

angel
Posts: 899
Joined: Thu Jan 15, 2004 12:07 am
Location: Germany - Palatinate

Post by angel » Wed Jul 12, 2006 8:04 am


mmaron
Posts: 5
Joined: Thu Jul 13, 2006 7:30 pm
Contact:

Re: Non-Liner Date Axis

Post by mmaron » Thu Jul 13, 2006 7:34 pm

Mubashar Iqbal wrote:Is it possible to have a DateAxis that is non linear in nature?

That is I only want to display values for dates that are in the DataSet not all those are are between and minimum, and maximum date.

Thanks in Advance,
Mubashar Iqbal
--
miqbal@geocities.com
It has been passed long time since it was posted. Is it still impossible? Do I have to override those methods to make it work? Can someone give me an example of how it works?

Thanks in advance

mmaron
Posts: 5
Joined: Thu Jul 13, 2006 7:30 pm
Contact:

PLEASE HELP

Post by mmaron » Fri Jul 14, 2006 11:48 pm

Please, this is very important to me. I need to fix it asap! Can someone give me a light?

rubenq
Posts: 5
Joined: Wed Jul 12, 2006 8:29 pm

Post by rubenq » Thu Jul 20, 2006 9:17 pm

Alternatively you could use a CategoryPlot where the rows would be your "series" and the columns would be the time points. It's not a perfect solution, but if you need it urgently, it does show only the specified points, as they are just categories.

You can even use a LineAndShapeRenderer to make it a line graph.

Just a thought.

- Ruben

mmaron
Posts: 5
Joined: Thu Jul 13, 2006 7:30 pm
Contact:

Post by mmaron » Thu Jul 20, 2006 11:57 pm

rubenq wrote:Alternatively you could use a CategoryPlot where the rows would be your "series" and the columns would be the time points. It's not a perfect solution, but if you need it urgently, it does show only the specified points, as they are just categories.

You can even use a LineAndShapeRenderer to make it a line graph.

Just a thought.

- Ruben
The problem is that i have a lot of lines to show and using CategoryPlot im forced to show the y-axis values of each category. So, it wont help me.

Thanks anyway

Locked