Problem with tickUnits, Percentage and bar graph

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
zabbala
Posts: 2
Joined: Thu Jan 31, 2008 11:42 pm

Problem with tickUnits, Percentage and bar graph

Post by zabbala » Thu Jan 31, 2008 11:49 pm

Hello,
I have a bar graph displaying some percentages (10%, 50%, 40%). The tickUnits displayed on the y-axis are 0%, 5%, 10%, 15%, ... ,i.e.: incrementing by 5%.
Is there any way I can modify the tickUnits to increment by 10%, as I know all the percentages I have to display are multiples of 10.
This is the code where I think the change should be but I'm not too sure:

Code: Select all

DecimalFormat chartDecimalFormat = new DecimalFormat("0%");
rangeAxis.setNumberFormatOverride(chartDecimalFormat);
rangeAxis.setRange(0.0, 1.0);
rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());
Thanks for all the help and great job on JFreeChart.

gummibear
Posts: 4
Joined: Wed Apr 11, 2007 4:29 pm
Location: Germany
Contact:

Problem with tickUnits, Percentage and bar graph

Post by gummibear » Mon Feb 04, 2008 9:18 am

Hello zaballa,

try this:

Code: Select all

rangeAxis.setTickUnit(new NumberTickUnit(0.1));
bye, bye

zabbala
Posts: 2
Joined: Thu Jan 31, 2008 11:42 pm

Post by zabbala » Mon Feb 04, 2008 3:34 pm

The fix you suggested works.
Thanks Gummibear.

Locked