display very small numbers at axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
michael.kuettner
Posts: 7
Joined: Thu Jul 17, 2008 2:52 pm

display very small numbers at axis

Post by michael.kuettner » Thu Jul 17, 2008 2:58 pm

I want to display very small numbers (downto 10e-20). If values get lower that 10e-6 only 0.000000 is displayed at axis. Is it possible to display scientific numbers (using ..e.. ) at the charts axis?

RoyW
Posts: 93
Joined: Wed Apr 23, 2008 7:42 pm
Contact:

Post by RoyW » Thu Jul 17, 2008 4:02 pm

You can use setNumberFormatOverride()

Code: Select all

        axis.setNumberFormatOverride(new DecimalFormat("00.0E0"));
And then create the DecimalFormat that you want.
The answer does not come from thinking outside the box, rather the answer comes from realizing the truth; There is no Box. my js site

michael.kuettner
Posts: 7
Joined: Thu Jul 17, 2008 2:52 pm

Post by michael.kuettner » Fri Jul 18, 2008 7:46 am

This works for numbers greater than about 10e-7. For lower values the same thing happens: 00.0E0 is displayed. It can also happen that just nothing is displayed at the axis if i zoom in a little bit more.

Is there any rounding issue? Can i force the chart to use full double precision?

michael.kuettner
Posts: 7
Joined: Thu Jul 17, 2008 2:52 pm

Post by michael.kuettner » Fri Jul 18, 2008 8:06 am

This is an example xy series i want to display (current over temperature):

Code: Select all

-40.0, 1.29233E-11
-40.0, 1.52194E-11
-40.0, 1.31989E-11
-40.0, 1.29233E-11
-40.0, 1.52194E-11
-40.0, 1.31989E-11
25.0, 1.93595E-11
25.0, 1.96145E-11
25.0, 1.9452E-11
25.0, 1.93595E-11
25.0, 1.96145E-11
25.0, 1.9452E-11
25.0, 1.93595E-11
25.0, 1.96145E-11
25.0, 1.9452E-11
25.0, 1.93595E-11
25.0, 1.96145E-11
25.0, 1.9452E-11
25.0, 1.93595E-11
25.0, 1.96145E-11
25.0, 1.9452E-11

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 » Fri Jul 18, 2008 8:49 am

This is something that needs fixing in the default case. For a workaround, try axis.setStandardTickUnits(new StandardTickUnitSource()). Or add some appropriate tick sizes to the tick unit collection used by the axis.
David Gilbert
JFreeChart Project Leader

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

michael.kuettner
Posts: 7
Joined: Thu Jul 17, 2008 2:52 pm

Post by michael.kuettner » Fri Jul 18, 2008 9:16 am

Using axis.setStandardTickUnits(new StandardTickUnitSource()) works fine!
Thanks for the quick answer!

Locked