HELP needed with Tick Units Conversion

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
conair
Posts: 2
Joined: Wed Feb 17, 2010 10:35 pm
antibot: No, of course not.

HELP needed with Tick Units Conversion

Post by conair » Wed Feb 17, 2010 10:50 pm

Hi there,
I am trying to plot a chart, which has dual range axis(y-axis). The x-axis units are immaterial in this case. Suppose my left Y-Axis has ticks 1,2,3,4,5 then I want my right y-axis to have tick units 2,4,6,8,10; where the tick unit 1 on the left axis corresponds to the tick unit 2 on the right axis i.e., 1 of left axis = 2 of right axis. I know how to create another axis by using the NumberAxis class and add it to the chart, but the left and right y-axis ticks do not correspond the way they are supposed to i.e. tick 1 on left axis comes in a straight line/corresponds with tick unit 2 of the right axis. Is there a method which can help me to get these units converted and have both the axes aligned properly? Any help shall be highly appreciated.

Thanks,
Sachin

jleech
Posts: 62
Joined: Fri Oct 26, 2007 9:18 pm

Re: HELP needed with Tick Units Conversion

Post by jleech » Fri Feb 19, 2010 4:43 pm

Sachin,

I accomplish essentially the same thing you are asking about by explicitly setting the margin and bounds of both Y axes, using setLowerMargin(), setUpperMargin(), and setRangeWithMargins() on both. In my case my left axis is a value and the right is a percent. I do not bind any datasets to the second axis... You don't specify if you are doing so or not, it may or may not matter.

-Jonathan

conair
Posts: 2
Joined: Wed Feb 17, 2010 10:35 pm
antibot: No, of course not.

Re: HELP needed with Tick Units Conversion

Post by conair » Fri Feb 19, 2010 9:40 pm

Thanks Jonathan. Even I tried the same way, but was hoping if there was a better way to do it.

Locked