jFreeCharts large number label display

109 views Asked by At

I am using jfreecharts to vreate a value-time chart. Data is gathered dynamically from web services and some times there are large numbers in it. The chart is created without any problem but the value axis labels are of this format: 2E10 etc. I would like to have 20000000000 displayed. I have not find any solution after 2 hours of rsearching. Can anyone suggest something?

1

There are 1 answers

0
Panagiotis Stoupos On BEST ANSWER

This fixed the problem:

 NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
           DecimalFormat newFormat = new DecimalFormat("0.0000");
           rangeAxis.setNumberFormatOverride(newFormat);

It also works when you have a dataset with largest value a float with 0 as integer part and at least the first 3 decimal digits to be 0 in which case labels also appear in negative power of 10 by default.