OS: Windows XP
JRE: 1.5.0_06
JFreeChart: 1.0.0
There is strange label truncation for category labels
along the bottom axis in a category bar chart. Long
labels that otherwise have room to display more of the
label are being truncated shorter than necessary.
In the attached example "FAZZY'S RESTAURANT, INC." is
truncated to "FRAZZY'S RESTAURAN..." but "AMANDA
QUICK/DORITOS" is truncated to just "AMAN...". The
other labels have also been truncated more than necessary.
Note that as the window is resized the truncation
usually sorts itself out but there are certain window
sizes that exhibit the problem (it almost looks like it
is truncating based on the length but then truncates
only the first word.)
A picture is attached and code is included below.
Sample code:
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.CategoryLabelPositions;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
public class LableTruncTest
{
public static void main(String[] args) {
String series = "Series";
DefaultCategoryDataset dataset = new
DefaultCategoryDataset();
dataset.addValue(2.0, series, "SUSAN SMITHER/DORITOS");
dataset.addValue(1.0, series, "ACCOUNTS
PAYABLE/DORITOS");
dataset.addValue(5.0, series, "AMANDA QUICK/DORITOS");
dataset.addValue(4.0, series, "FAZZY'S RESTAURANT,
INC.");
JFreeChart chart =
ChartFactory.createBarChart("Funky
Labels",null,null,dataset,PlotOrientation.VERTICAL,true,true,false
);
chart.setAntiAlias(true);
CategoryPlot plot = chart.getCategoryPlot();
plot.getDomainAxis().setCategoryLabelPositions(
CategoryLabelPositions.createUpRotationLabelPositions(45.0*Math.PI/180.0)
);
ChartFrame frame = new ChartFrame("Funky Labels", chart);
frame.setSize(577,345);
frame.setVisible(true);
}
}
David Gilbert
General
1.0.x
Public
|
Date: 2009-03-31 20:58 I found it odd that createTextBlock replaced the last three characters of |
|
Date: 2009-02-06 15:11 Unfortunately, this defect has been reproduced with the latest JFreeChart |
|
Date: 2008-01-18 12:55
|
|
Date: 2006-05-05 16:03 Logged In: YES |
|
Date: 2006-01-20 14:40 Logged In: YES |
| Filename | Description | Download |
|---|---|---|
| labeltrunc.png | Snap shot of strange label truncation | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| priority | 5 | 2006-01-20 14:40 | mungady |
| assigned_to | nobody | 2006-01-20 14:40 | mungady |
| File Added | 164053: labeltrunc.png | 2006-01-19 18:52 | as6o |
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use