Avoid thousands separator

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
echrsmh
Posts: 2
Joined: Fri Sep 12, 2014 10:54 am
antibot: No, of course not.

Avoid thousands separator

Post by echrsmh » Tue Sep 16, 2014 7:44 am

Hello,

I like to avoid that that the numbers displayed in the charts have thousands separators (like 3,000.0, it should look like this 3000.0).

I am looking for a general setting that dont affect the (usually) smart auto formatting of numbers in charts.

I am working with Locale.US. One idea was to change the settings of locale, but I didt find a way to get my result ("." for decimal separators and nothing for thousands separators).

Anyone has an idea?

Chris

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

Re: Avoid thousands separator

Post by david.gilbert » Wed Sep 17, 2014 8:19 pm

You could take the NumberTickUnitSource class and change this line:

Code: Select all

private DecimalFormat df0 = new DecimalFormat("#,##0");
...to remove the thousands separator. Basically copy and paste the class to a new one called MyNumberTickUnitSource...then set the tick unit source on your axis to an instance of this class. Not the nicest solution, but it would work.
David Gilbert
JFreeChart Project Leader

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

Locked