I use a 3D BarChart (with vertical orientation) with a subcategory axis.
I need vertical labels for sub-categories and horizontal labels for primary categories, but calling the method setCategoryLabelPositions on the SubCategoryAxis object, only affects the primary axis! How can I fix it?
Any help would be highly appreciated.
HELP! can't set subCategory LabelPositions
I think a list of the code which creates the chart may be helpful:
Can you see any error?
Please, it is very important for us to have a readable chart!
Regards
Code: Select all
private JFreeChart createChart(final CategoryDataset dataset) {
final JFreeChart chart = ChartFactory.createBarChart3D(
"T1-T2 Donor", // chart title
"Periodo", // domain axis label
"Numero disattivazioni", // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
true, // include legend
true, // tooltips
false // urls
);
final CategoryPlot plot = chart.getCategoryPlot();
final BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
renderer.setDrawBarOutline(false);
renderer.setItemLabelsVisible(true);
SubCategoryAxis domainAxis = new SubCategoryAxis("Quindicina / mese");
domainAxis.setCategoryMargin(0.05);
domainAxis.addSubCategory("Prima quindicina");
domainAxis.addSubCategory("Seconda quindicina");
/****************************************************************************
* THE FOLLOWING STATEMENT DOES NOT WORK PROPERLY!!!
****************************************************************************/
domainAxis.SetCategoryLabelPositions(CategoryLabelPositions.UP_90);
plot.setDomainAxis(domainAxis);
plot.setFixedLegendItems(createLegendItems());
return chart;
}
Please, it is very important for us to have a readable chart!
Regards
-
- Posts: 5
- Joined: Wed Nov 15, 2006 5:03 pm
know its a bit late, but only started using jfree chart and managed to solve this using font manipulation.
where domain axis is my subcategory axis
Just need to move the position of the category axis labels down a bit as currently they overlap
Code: Select all
domainAxis.setSubLabelFont((java.awt.Font)domainAxis.getSubLabelFont().deriveFont(1, new java.awt.geom.AffineTransform().getRotateInstance(Math.PI / 2.5)));
Just need to move the position of the category axis labels down a bit as currently they overlap