hi,
my y axis show me value like 10.0000
how can i show in my y axis only decimal values(ex:10)
set decimal value in my y axis
-
- Posts: 12
- Joined: Tue Aug 25, 2009 9:12 am
- antibot: No, of course not.
Re: set decimal value in my y axis
Hi
you should be able to achieve that by using a formatter:
1. Create a formatter
DecimalFormat format = (DecimalFormat)DecimalFormat.getNumberInstance(Locale.ENGLISH);
format.applyPattern("#,##0");
In case there could be decimals, for example 10.5 you should use:
format.applyPattern("#,##0.##");
2. Apply the formatter to your axis (assuming you have generated the plot already, you get the axis by plot.getRangeAxis() -> you might the cast it to NumberAxis for example - depending on your axis type though )
axis.setNumberFormatOverride(format);
k
you should be able to achieve that by using a formatter:
1. Create a formatter
DecimalFormat format = (DecimalFormat)DecimalFormat.getNumberInstance(Locale.ENGLISH);
format.applyPattern("#,##0");
In case there could be decimals, for example 10.5 you should use:
format.applyPattern("#,##0.##");
2. Apply the formatter to your axis (assuming you have generated the plot already, you get the axis by plot.getRangeAxis() -> you might the cast it to NumberAxis for example - depending on your axis type though )
axis.setNumberFormatOverride(format);
k