Format a VerticalNumberAxis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Fabien Boulesteix

Format a VerticalNumberAxis

Post by Fabien Boulesteix » Thu Apr 12, 2001 2:46 pm

Hi,
I found a little bug in JFreeChart.
I had a problem with formatting a VertivalNumberAxis. I defined a DecimalFormatSymbols for a new pattern :
VerticalNumberAxis myVerticalAxis = (VerticalNumberAxis) myPlot.getAxis(Plot.VERTICAL_AXIS);
java.text.DecimalFormatSymbols dfs = new java.text.DecimalFormatSymbols();
dfs.setGroupingSeparator('.');
dfs.setDecimalSeparator(',');
myVerticalAxis.getTickLabelFormatter().setDecimalFormatSymbols(dfs);

But when I resize the graph, the format symbols change to the defaults.

In the refreshTicks of the VerticalNumberAxis, I have change the following line to keep the format symbols :

DecimalFormatSymbols decimalFormatSymbols = tickLabelFormatter.getDecimalFormatSymbols();
tickLabelFormatter = new DecimalFormat(tickLabelFormatter.toPattern());
tickLabelFormatter.setDecimalFormatSymbols(decimalFormatSymbols);

And it works.

Regards,
Fabien

David Gilbert

RE: Format a VerticalNumberAxis

Post by David Gilbert » Tue Apr 24, 2001 1:09 pm

Hi Fabien,

Thanks for your post. The work-around you suggest looks good. Actually it's a workaround on top of a workaround - take a look at these early postings in the JFreeChart discussion forum:

<a href="http://jrefinery.com/forums/read.phtml? ... 6&t=116</a>

Regards,

DG.

Locked