Hi ,
Does anybody know how to change the labels in the Verticle Stacked Bar Chart? I want to change Category 1 ..... Category 4 to a different font.I know how to change the series font :
((StandardLegend)chartLegend).setItemFont(new Font("ITALIC", 23,23));
Which works fine. I tried to use the setLabelPaint(); in the CategoryPlot class, but does not seem to work.
I would appreciate any help on this
Regards
Dominique
Changing font of category labels
Re: Changing font of category labels
The category labels are generated using the toString() method on the objects used to represent the categories in the CategoryDataset. So you need to look at the class you are using to implement the CategoryDataset interface, to see what methods it has to change the categories. If it is DefaultCategoryDataset, then you can use the setCategories(...) method.
Regards,
DG.
Regards,
DG.
Re: Changing font of category labels
Sorry, I didn't read the question properly.
You need to get a reference to the HorizontalCategoryAxis, then call the setLabelFont(...) method:
CategoryPlot plot = myChart.getCategoryPlot();
CategoryAxis axis = plot.getDomainAxis();
axis.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
Regards,
DG.
You need to get a reference to the HorizontalCategoryAxis, then call the setLabelFont(...) method:
CategoryPlot plot = myChart.getCategoryPlot();
CategoryAxis axis = plot.getDomainAxis();
axis.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
Regards,
DG.