List of usage examples for org.jfree.chart.renderer.category BarRenderer3D setPositiveItemLabelPosition
public void setPositiveItemLabelPosition(ItemLabelPosition position)
From source file:org.eevolution.form.CRPDetail.java
/** * Create Chart based on UOM/*from w w w . j a v a 2s. c o m*/ * * @param dataset * @param title * @param uom * @return JFreeChart Chart based On UOM */ public JFreeChart createChart(CategoryDataset dataset, String title, MUOM uom) { JFreeChart chart = ChartFactory.createBarChart3D(title, Msg.translate(Env.getCtx(), "Day"), // X-Axis label Msg.translate(Env.getCtx(), (uom == null) ? "" : uom.getName()), // Y-Axis // label dataset, // Dataset PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); chart.setBackgroundPaint(Color.WHITE); chart.setAntiAlias(true); chart.setBorderVisible(true); CategoryPlot plot = chart.getCategoryPlot(); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.GRAY); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.GRAY); BarRenderer3D barrenderer = (BarRenderer3D) plot.getRenderer(); barrenderer.setDrawBarOutline(false); barrenderer.setBaseItemLabelGenerator(new LabelGenerator()); barrenderer.setBaseItemLabelsVisible(true); barrenderer.setSeriesPaint(0, new Color(10, 80, 150, 128)); barrenderer.setSeriesPaint(1, new Color(180, 60, 50, 128)); ItemLabelPosition itemlabelposition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.TOP_CENTER); barrenderer.setPositiveItemLabelPosition(itemlabelposition); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); return chart; }