Formatting vertical tick labels

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

Formatting vertical tick labels

Post by Fran Aquino » Thu Feb 27, 2003 9:37 am

First of all excuse my poor english :(, and thanks for JFreeChart and this forum.
I'm doing a timeseries plot, rendering 4 series on the same plot. These series all correspond to different units (each with its own range for typicall values) so I normalize the values of all series into the range [0, 1] to make the graph easily readable (max values show aligned on the same horizontal line, as well as min values)
Now I'd like to format the labels on the vertical axis to de-normalize tick values, so the user can see the actual data values, but I can't find the way to do this.
¿Any ideas? Thanks in advance and excuse this rather long post.

David Gilbert

Re: Formatting vertical tick labels

Post by David Gilbert » Fri Feb 28, 2003 1:41 am

Hi Fran,

I don't fully understand what you are trying to do...can you explain some more?

Regards,

Dave Gilbert

Fran Aquino

Re: Formatting vertical tick labels

Post by Fran Aquino » Fri Feb 28, 2003 2:47 pm

I'm doing this to show the evolution of some life constants (blood pressure, temperature, heart rate...) Each of these constants has its own units (mmHg, º Celsius, bpm), so the values for each series are normalized into an interval of 'typical' values (34ºC-42ºC for temperature, 15bpm-180bpm, etc) This way, after normalization, a temperature of 34ºC is 0, or a heartbeat of 100bpm would be around 0.5.
However, the labels in the vertical axis show 0.0, 0.2,... 0.8, 1.0, and I need to 'denormalize' the labels values so the user can see the actual (before normalization) values.

Thanks again, David.

David Gilbert

Re: Formatting vertical tick labels

Post by David Gilbert » Tue Mar 04, 2003 10:48 am

Hi Fran,

There isn't a way to denormalize the values for display on the axis, unless you want to write your own axis class (which is possible).

As an alternative, you could leave your dataset in its original form and use a secondary dataset and secondary axis to display two series on two different scales. See the DualAxisDemo2.java application for an example.

But you have three series...I'm not so sure how to handle that.

Regards,

Dave Gilbert

Fran Aquino

Re: Formatting vertical tick labels

Post by Fran Aquino » Tue Mar 04, 2003 11:42 am

So currently there's no way to enumerate ticks on an axis and change the text ¿right?

I'll try to get the job done with combined plots, then, to avoid the normalization step.

Thanks a lot, Dave. I think JFreeChart is one of those projects which make Open Source so valuable. GREAT job.

Fran Aquino

Re: Formatting vertical tick labels

Post by Fran Aquino » Mon Mar 10, 2003 7:26 pm

I've been doing a little digging into the source.
Perhaps the easiest way to accomplish what i'm looking for would be to extend VerticalNumberAxis (as in VerticalNumberAxis3D, for example VerticalNumberAxisNorm), providing methods to set the maximun and minimum values used for normalization. So it will be easy to de-normalize at draw time.
Or it might be better just exposing an iterator for the ticks collection.

Both of these two approaches surely have hidden implications for me at this time however, as I'm quite new to Java. I'm using JBuilder, and haven't been succesful compiling the sources yet :(

I'll keep you informed. I'd would be glad to contribute.

Locked