Dual-RangeAxis?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
JSlowik
Posts: 2
Joined: Mon May 23, 2011 5:54 pm
antibot: No, of course not.

Dual-RangeAxis?

Post by JSlowik » Mon Jun 06, 2011 8:57 pm

Hello all,

I currently am making a time-series plot of weather data, where the X value is time, the Y value is a given atmospheric pressure, and a Z value shall be used to assign a given value to the X/Y point (which will be Temperature, Wind Speed, Humidity, etc). While I have all this working fine, the problem I am currently running into is a second requirement, in which a standard atmosphere bar will be displayed next to the Range Axis.

To do this, I have added a second RangeAxis to my plot, which is drawn along side the main Range (pressure) Axis. However, I would like the axis to be able to plot values on each side of it. Specifically, I would like to render Altitude in feet on one side of the bar, and Altitude in kilometers on the other.

I have extended the ValueAxis to do this, and have overridden the refreshTicks() method. As I loop through my pre-set tick values, for values in feet I add NumberTicks that use TextAnchor.CENTER_RIGHT. These values plot correctly.

The issue occurs when I attempt to add the values in kilometers to the right side of the axis bar, using TextAnchor.CENTER_LEFT. For low numbers (< 10), the values are appearing on the left side of the axis, instead of the right. For values over 10, they are being rendered directly on top of the axis bar. Is there a way I am missing to render values on the right side of an axis, even though the axis is on the left side of a plot? Thanks in advance.

Locked