I am using JfreeChart 1.0.15 library.
I want to show percentage score of the college and branches, so I used setNumberFormatOverride()
method
final NumberAxis valueAxis = new NumberAxis("Percentage Score");
valueAxis.setNumberFormatOverride(NumberFormat.getPercentInstance());
It is showing me the %
sign on the Y-axis
but all the values are getting multiplied by 100.
See the Y-axis
values. Label values on the bars are correct.
If I divide each value by 100 then Y-axis
values are correct (e.g. 15%,19%,25%,27%) but label values are displaying wrong (e.g. 0.15,0.19,0.25,0.27).
Below code also won't give the desired output
DecimalFormat pctFormat = new DecimalFormat("#.0%");
valueAxis.setNumberFormatOverride(pctFormat);
I tried different solutions from
- http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=30345
- http://www.infocaptor.com/dashboard/number-and-percent-format-for-charts-bar-line-etc
- http://jfree.org/phpBB2/viewtopic.php?f=3&t=24268
- http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=13797&sid=8459981dcbb26de2f55be5c4da97e51a
none of them worked.
If you need more information let me know.