private JFreeChart getBarChart() { // Load the data, if necessary loadData(); // Create the vertical bar chart final JFreeChart chart = ChartFactory.createBarChart( getTitle(), "", "", getCategoryDataset(), PlotOrientation.HORIZONTAL, false, true, false); final CategoryPlot categoryplot = (CategoryPlot) chart.getPlot(); categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); categoryplot.setRangePannable(true); categoryplot.setNoDataMessage("No data available"); final BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setItemLabelAnchorOffset(9D); barrenderer.setBaseItemLabelsVisible(true); barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); // barrenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{1} = {2}", new // DecimalFormat("0"))); final CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setCategoryMargin(0.25D); categoryaxis.setUpperMargin(0.02D); categoryaxis.setLowerMargin(0.02D); final NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis.setUpperMargin(0.10000000000000001D); ChartUtilities.applyCurrentTheme(chart); // if (useLegend()) // { // // pieplot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({1})")); // chart.getLegend().setPosition(RectangleEdge.RIGHT); // // pieplot.setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator("{0}: // {2}%")); // } return chart; }