List of usage examples for org.jfree.chart.renderer.category GroupedStackedBarRenderer setPositiveItemLabelPositionFallback
public void setPositiveItemLabelPositionFallback(ItemLabelPosition position)
From source file:org.jfree.chart.demo.StackedBarChartDemo5.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createStackedBarChart("Stacked Bar Chart Demo 5", "Category", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); GroupedStackedBarRenderer groupedstackedbarrenderer = new GroupedStackedBarRenderer(); KeyToGroupMap keytogroupmap = new KeyToGroupMap("G1"); keytogroupmap.mapKeyToGroup("S1", "G1"); keytogroupmap.mapKeyToGroup("S2", "G1"); keytogroupmap.mapKeyToGroup("S3", "G2"); keytogroupmap.mapKeyToGroup("S4", "G3"); groupedstackedbarrenderer.setSeriesToGroupMap(keytogroupmap); groupedstackedbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); groupedstackedbarrenderer.setBaseItemLabelsVisible(true); groupedstackedbarrenderer.setPositiveItemLabelPositionFallback( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER)); groupedstackedbarrenderer.setItemMargin(0.10000000000000001D); SubCategoryAxis subcategoryaxis = new SubCategoryAxis("Category / Group"); subcategoryaxis.setCategoryMargin(0.050000000000000003D); subcategoryaxis.addSubCategory("G1"); subcategoryaxis.addSubCategory("G2"); subcategoryaxis.addSubCategory("G3"); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainAxis(subcategoryaxis); categoryplot.setRenderer(groupedstackedbarrenderer); return jfreechart; }