#700 1.0.3: tick labels overlap with custom NumberFormat/Horizont

General (896)

When I use a custom label number format on a horizontal (bar) chart, the label overlap. Depending on the chart (frame) size, they overlap very badly.

Here's a test chart that shows the problem (chart frame width of 400):

* This test shows axis labels overlap on horizontal bar charts if a custom label format is used and the chart size is not too big.
* @return JFreeChart.
private JFreeChart testBarLabelOverlap() {
JFreeChart result = null;

DefaultCategoryDataset cd = new DefaultCategoryDataset();
cd.addValue(8.53496, "Series1", "Category1");

result = ChartFactory.createBarChart("Vertical Bar Chart", "Categories", "Values", cd, PlotOrientation.HORIZONTAL, false, false, false);

final CategoryPlot plot = result.getCategoryPlot();
final ValueAxis va = plot.getRangeAxis();
((NumberAxis) va).setNumberFormatOverride(new DecimalFormat("#0.0# %"));

return result;


  • m.hilpert

    m.hilpert - 2006-12-04
    • priority: 5 --> 8
  • David Gilbert

    David Gilbert - 2006-12-11
    • labels: --> General
    • milestone: --> 1.0.x
    • assigned_to: nobody --> mungady
    • status: open --> closed-fixed
  • David Gilbert

    David Gilbert - 2006-12-11

    Logged In: YES
    Originator: NO

    Thanks for the report (and especially the test code). The problem is just in the code that looks at the tick label width, it was using the default formatting, and not the override you specified. I've committed a fix to CVS, for inclusion in the 1.0.4 release.


Log in to post a comment.