XYPlot Exponential Y Axis smoother scrolling

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
snoopygee
Posts: 18
Joined: Wed Jan 28, 2009 3:10 pm

XYPlot Exponential Y Axis smoother scrolling

Post by snoopygee » Wed May 13, 2009 4:24 pm

Hi guys, I have a small problem that I hope you can advise me on.

I've implemented an XYPlot with a linear x-axis and exponential y-axis, each axis with it's own scroll bar.

As the x-axis is linear enabling a consistant scrolling action is very easy, If I have 100 points on the axis I simply set the appropriate scrollpane limits and then use the srollbar value to reset the x-bounds of the chart.

However as the y-axis is exponential, using the linear values from the scrollpane does not resize the chart correctly. Where the exponential values are relitively close together the chart scrolls very quickly, where the values are very far apart the chart scrolls very slowely. I'm wondering whether there is a built in method which might help me maintain an even scroll through the chart?

Thanks
Snoopygee

snoopygee
Posts: 18
Joined: Wed Jan 28, 2009 3:10 pm

Re: XYPlot Exponential Y Axis smoother scrolling

Post by snoopygee » Fri May 15, 2009 2:14 pm

Guys, I've had an idea how I can occomplish this but still stuck on a small detail.

If I can return the unit amount currently being used on a given axis, then I can iterate this amount with my scroll bar.

For example, for the easy linear axis of 1 - 100 with 10 tick unit markers, the tick interval would be 10, therefore I can iterate 10 at a time with the scrollbar. For the exponential log10 axis (which I'm interested in), it's tick units could be 100000, 10000, 1000, 100, 10, 1, 0.1, 0.01, 0.001. Now depending where I am scrolling on this axis the tick unit interval could be anything from 90,000 to 0.9. I can then use this interval amount to determine how much I should ask the chart to scroll.

Put simpy is there a way of finding out from the axis what the current tick intervals are? Something like:

Code: Select all

...
double[] dTickIntervals = XYplot.getRangeAxis().getVisibleTickUnitIntervals();
...
Thanks for any help

snoopygee
Posts: 18
Joined: Wed Jan 28, 2009 3:10 pm

Re: XYPlot Exponential Y Axis smoother scrolling

Post by snoopygee » Mon May 18, 2009 9:38 am

Guys,

Anyone have any idea's about how to return the tick intervals at a given point yet?

Thanks
Snoopygee

Locked