Scaling Y axis.

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
arkadye
Posts: 9
Joined: Fri May 19, 2006 7:02 pm

Scaling Y axis.

Post by arkadye » Tue Oct 31, 2006 2:39 am

Hi,

I have the following problem. My charts display onfo with very high Y coordinates. Let's say the Y range falls between $100,000,000 and $600,000,000. As a result there is a lot of space wasted on the tick labels since JFreeChart generates $100,000,000.00. Is it possible to configure the chart to generate numbers in millions of dollars, which would get translated into much more compact labels between 100 and 600?

Thanks.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Tue Oct 31, 2006 3:14 pm

The best approach would be to write your own subclass of NumberFormat to handle this. I'll put it on my to-do list, because it would be nice to have this feature generally available.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

arkadye
Posts: 9
Joined: Fri May 19, 2006 7:02 pm

Post by arkadye » Tue Oct 31, 2006 6:35 pm

Thanks for the prompt reply, David.

Unfortunately, writing a custom formatter is not a viable option for me because the requirement is - based on the dataset, being able to scale either by deviding by 1000, or by 1000000 or 1000000000. For example, if maximum value in the dataset is greater than 1000000 but less than 1000000000, we would like to devide eahc value by 1000000 and present all tick labels in millions. So this requires analyzing the whole dataset before making a decision how to scale.

thetoolman
Posts: 1
Joined: Thu Oct 06, 2005 2:27 am

Post by thetoolman » Wed Jan 24, 2007 12:57 am

David (or anyone else) made this addition to the codebase yet?

I have a very similar need - data might be in the 0, kilo or mega range, and I want the axis to note the top end of the scale and suffix the axis appropriately ie 10k instead of 10,000.

I will go and implement myself if not already done...

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Jan 24, 2007 4:22 pm

It hasn't been done...if you can contribute something, that would be awesome!
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked