lining up Number Axis with Date Axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Fred
Posts: 38
Joined: Sat Dec 12, 2015 4:57 pm
antibot: No, of course not.

lining up Number Axis with Date Axis

Post by Fred » Fri Feb 10, 2017 10:01 pm

All,

I have a chart with a default Range (Y) axis that is a Number Axis.
I also have a secondary Range (Y) Axis that is a Date Axis of that same data.

My problem is related to the Date Axis presents time that does not line up with the
data on the Number Axis. Even if I set the number of Time Tick Units (TTUs) to
the same number presented on the Number Axis, the Date Axis does not line up
which leads one to evaluate the date associated to the number being wrong.

On the surface this doesn't appear to be much of a problem until you are looking
at 100,000 plus piece of data.

Is there a way to set the Date Axis TTU's to the same point/line presented on the Number (Y) axis?

Thanks

Fred

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: lining up Number Axis with Date Axis

Post by paradoxoff » Sun Feb 12, 2017 9:28 pm

In the absence of code and/or an image, it is hard to advise. It would be useful to see how you have managed to get the two axes at least roughly lined up (two datasets with same content, or mapping of a single dataset to two range axes). Due to the different value ranges of a number axis and a date axis, I can't imagine a simple way to get that done.
Have you thought about using two NumberAxes, and using a custom NumberFormat to make the tick labels look like dates?

Fred
Posts: 38
Joined: Sat Dec 12, 2015 4:57 pm
antibot: No, of course not.

Re: lining up Number Axis with Date Axis

Post by Fred » Mon Feb 13, 2017 4:45 pm

Pardoxoff.. as always.. thank you. I wish I could show you what I'm trying to do and I'll look to see if I can get that up here.
In the mean time, I was thinking the same thought (2 number axis but format the second with a custom label). I will be
trying that first and in the event it doesn't work I'll get something up here that shows the issue.

Fred

Fred
Posts: 38
Joined: Sat Dec 12, 2015 4:57 pm
antibot: No, of course not.

Re: lining up Number Axis with Date Axis

Post by Fred » Mon Feb 13, 2017 8:04 pm

All,

The problems been resolved. The issue was the method used to collect the actual first record within the zoomed section of the chart
versus what should have been the upper and lower (times) for that portion of the chart. The problem occurs when there is significant
amount of blank-spacing before the first data point and or after the last data point.

Once I modified the method to use the upper and lower (times) values the secondary Y (range) axis is spot on.

Thanks Paradoxoff for getting me to think about the problem differently.

R,

Fred

Locked