Number format override is not working in JDK 1.8

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
tgbaiju
Posts: 3
Joined: Wed Aug 10, 2016 12:32 pm
antibot: No, of course not.

Number format override is not working in JDK 1.8

Post by tgbaiju » Wed Aug 10, 2016 12:46 pm

Hi,

I am using jfreechart 1.0.13, for my chart I need to have a custom number formater. The custom formater was working fine in Java version 1.7, we are in the process to upgrade Java to 1.8. While generating the chart the in Java 1.8 our number formatting is not applied in the chart.

Upon debugging from the NumberAxix.estimateMaximumTickLabelWidth method the call is not forwarded to our formater. But in 1.7 it was correctly executing our overriden format(double number,
StringBuffer toAppendTo,
FieldPosition pos)
method.

Please advice how to resolve this. Please let me know if more details are required.

Thanks,
Baiju

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Number format override is not working in JDK 1.8

Post by paradoxoff » Thu Aug 11, 2016 8:30 am

NumberAxix.estimateMaximumTickLabelWidth does not call the method format(double number,StringBuffer toAppendTo,FieldPosition pos). The NumberFormat class does not appear to have changed between 7 and 8.
Are you sure that nothing else has changed?

tgbaiju
Posts: 3
Joined: Wed Aug 10, 2016 12:32 pm
antibot: No, of course not.

Re: Number format override is not working in JDK 1.8

Post by tgbaiju » Thu Aug 11, 2016 11:50 am

Hi,

Thanks for your response, nothing else is changed in our code. While debugging from the NumberAxix.estimateMaximumTickLabelWidth method, our overrided method was executed in the Java 7, but in Java 8 our method was not called/executed. Not sure why.

The same code is working fine with Java 1.7.

Thanks,
Baiju

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Number format override is not working in JDK 1.8

Post by paradoxoff » Thu Aug 11, 2016 8:26 pm

If the same code is working under java 7, and not under java 8, I assume that it is a change or a bug in java 8.
You could create a NumberAxis and a Graphics2D (for example, by using the Graphics2D of a BufferedImage), then call the NumberAxix.estimateMaximumTickLabelWidth directly and floow with a debugger the methods that are being called.

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Number format override is not working in JDK 1.8

Post by John Matthews » Thu Aug 11, 2016 11:16 pm

Also verify that your program is correctly synchronized, as shown here. Use either of the approaches cited here to find violations at compile time.

Locked