Example usage for org.jfree.chart.title LegendTitle setFrame

List of usage examples for org.jfree.chart.title LegendTitle setFrame

Introduction

In this page you can find the example usage for org.jfree.chart.title LegendTitle setFrame.

Prototype

public void setFrame(BlockFrame frame) 

Source Link

Document

Sets the frame (or border).

Usage

From source file:org.jfree.chart.demo.StackedXYBarChartDemo2.java

private static JFreeChart createChart(TableXYDataset tablexydataset) {
    DateAxis dateaxis = new DateAxis("Date");
    dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);
    dateaxis.setLowerMargin(0.01D);//w w  w. j  av  a  2  s . c  om
    dateaxis.setUpperMargin(0.01D);
    NumberAxis numberaxis = new NumberAxis("Count");
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    numberaxis.setUpperMargin(0.10000000000000001D);
    StackedXYBarRenderer stackedxybarrenderer = new StackedXYBarRenderer(0.14999999999999999D);
    stackedxybarrenderer.setDrawBarOutline(false);
    stackedxybarrenderer.setBaseItemLabelsVisible(true);
    stackedxybarrenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    stackedxybarrenderer.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER));
    stackedxybarrenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator("{0} : {1} = {2}",
            new SimpleDateFormat("yyyy"), new DecimalFormat("0")));
    XYPlot xyplot = new XYPlot(tablexydataset, dateaxis, numberaxis, stackedxybarrenderer);
    JFreeChart jfreechart = new JFreeChart("Holes-In-One / Double Eagles", xyplot);
    jfreechart.removeLegend();
    jfreechart.addSubtitle(new TextTitle("PGA Tour, 1983 to 2003"));
    TextTitle texttitle = new TextTitle(
            "http://www.golfdigest.com/majors/masters/index.ssf?/majors/masters/gw20040402albatross.html",
            new Font("Dialog", 0, 8));
    jfreechart.addSubtitle(texttitle);
    jfreechart.setTextAntiAlias(RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
    LegendTitle legendtitle = new LegendTitle(xyplot);
    legendtitle.setBackgroundPaint(Color.white);
    legendtitle.setFrame(new BlockBorder());
    legendtitle.setPosition(RectangleEdge.BOTTOM);
    jfreechart.addSubtitle(legendtitle);
    return jfreechart;
}

From source file:org.jfree.chart.demo.DualAxisDemo1.java

private static JFreeChart createChart() {
    JFreeChart jfreechart = ChartFactory.createBarChart("Dual Axis Chart", "Category", "Value",
            createDataset1(), PlotOrientation.VERTICAL, false, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot();
    categoryplot.setBackgroundPaint(new Color(238, 238, 255));
    categoryplot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT);
    CategoryDataset categorydataset = createDataset2();
    categoryplot.setDataset(1, categorydataset);
    categoryplot.mapDatasetToRangeAxis(1, 1);
    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_45);
    NumberAxis numberaxis = new NumberAxis("Secondary");
    categoryplot.setRangeAxis(1, numberaxis);
    LineAndShapeRenderer lineandshaperenderer = new LineAndShapeRenderer();
    lineandshaperenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    categoryplot.setRenderer(1, lineandshaperenderer);
    categoryplot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    LegendTitle legendtitle = new LegendTitle(categoryplot.getRenderer(0));
    legendtitle.setMargin(new RectangleInsets(2D, 2D, 2D, 2D));
    legendtitle.setFrame(new BlockBorder());
    LegendTitle legendtitle1 = new LegendTitle(categoryplot.getRenderer(1));
    legendtitle1.setMargin(new RectangleInsets(2D, 2D, 2D, 2D));
    legendtitle1.setFrame(new BlockBorder());
    BlockContainer blockcontainer = new BlockContainer(new BorderArrangement());
    blockcontainer.add(legendtitle, RectangleEdge.LEFT);
    blockcontainer.add(legendtitle1, RectangleEdge.RIGHT);
    blockcontainer.add(new EmptyBlock(2000D, 0.0D));
    CompositeTitle compositetitle = new CompositeTitle(blockcontainer);
    compositetitle.setPosition(RectangleEdge.BOTTOM);
    jfreechart.addSubtitle(compositetitle);
    return jfreechart;
}

From source file:org.jfree.chart.demo.XYTitleAnnotationDemo1.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date",
            "Price Per Unit", xydataset, false, true, false);
    jfreechart.setBackgroundPaint(Color.white);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);
    LegendTitle legendtitle = new LegendTitle(xyplot);
    legendtitle.setItemFont(new Font("Dialog", 0, 9));
    legendtitle.setBackgroundPaint(new Color(200, 200, 255, 100));
    legendtitle.setFrame(new BlockBorder(Color.white));
    legendtitle.setPosition(RectangleEdge.BOTTOM);
    XYTitleAnnotation xytitleannotation = new XYTitleAnnotation(0.97999999999999998D, 0.02D, legendtitle,
            RectangleAnchor.BOTTOM_RIGHT);
    xytitleannotation.setMaxWidth(0.47999999999999998D);
    xyplot.addAnnotation(xytitleannotation);
    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(true);
        xylineandshaperenderer.setBaseShapesFilled(true);
    }//from  w  w w.jav  a2  s  .  c o  m
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    ValueAxis valueaxis = xyplot.getRangeAxis();
    valueaxis.setLowerMargin(0.34999999999999998D);
    return jfreechart;
}

From source file:org.jfree.experimental.chart.demo.XYTitleAnnotationDemo1.java

/**
 * Creates a chart.//from  w  w  w .j av a  2  s .  c  o  m
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", // title
            "Date", // x-axis label
            "Price Per Unit", // y-axis label
            dataset, // data
            false, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    LegendTitle lt = new LegendTitle(plot);
    lt.setItemFont(new Font("Dialog", Font.PLAIN, 9));
    lt.setBackgroundPaint(new Color(200, 200, 255, 100));
    lt.setFrame(new BlockBorder(Color.white));
    lt.setPosition(RectangleEdge.BOTTOM);
    XYTitleAnnotation ta = new XYTitleAnnotation(0.98, 0.02, lt, RectangleAnchor.BOTTOM_RIGHT);

    ta.setMaxWidth(0.48);
    plot.addAnnotation(ta);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));

    ValueAxis yAxis = plot.getRangeAxis();
    yAxis.setLowerMargin(0.35);
    return chart;

}

From source file:y.graphs.ChartHelperELF.java

private static JFreeChart createChart(final TimeSeriesCollection dataset, Date from, Date to, Config config,
        ArrayList<ConfigSerie> series) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(Config.getResource("MsgTitleMagGraph"),
            Config.getResource("TitleDate"), Config.getResource("MsgTitleMagGraphYAxis"), dataset, true, // include legend
            true, // tooltips
            false // urls
    );/* www .  j  ava 2  s  .c  o  m*/

    chart.setBackgroundPaint(Color.white);

    final XYPlot plot = chart.getXYPlot();
    LegendTitle lt = new LegendTitle(plot);
    lt.setItemFont(new Font("Dialog", Font.PLAIN, 12));
    lt.setBackgroundPaint(Color.white);
    lt.setFrame(new BlockBorder(Color.white));
    lt.setVerticalAlignment(VerticalAlignment.CENTER);
    XYTitleAnnotation ta = new XYTitleAnnotation(config.getLegendX(), config.getLegendY(), lt,
            RectangleAnchor.TOP_RIGHT);
    ta.setMaxWidth(config.getLegendSize());
    plot.addAnnotation(ta);
    chart.removeLegend();

    plot.setBackgroundPaint(config.getColorBackgroundELF());
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    final Stroke lineStroke = new BasicStroke((float) config.getLineWidthELF());

    for (int si = 0; si < series.size(); si++) {
        final ConfigSerie cs = series.get(si);
        renderer.setSeriesLinesVisible(si, cs.isDrawLine());

        final float size = cs.getShapeSize();
        renderer.setSeriesShapesVisible(si, size > 0);
        if (size > 0)
            renderer.setSeriesShape(si, ShapeUtilities.createRegularCross(size, size));

        renderer.setSeriesStroke(si, lineStroke);
        //            renderer.setSeriesOutlineStroke(si, lineStroke);
        renderer.setSeriesPaint(si, cs.getColor());
    }
    plot.setRenderer(renderer);

    // x axis
    final DateAxis rangeAxis = (DateAxis) plot.getDomainAxis();
    //        rangeAxis.setStandardTickUnits(DateAxis.createStandardDateTickUnits()); // Returns a collection of standard date tick units that uses the default time zone. This collection will be used by default, but you are free to create your own collection if you want to
    rangeAxis.setAutoRange(true);
    //        rangeAxis.setRange(from, to);
    rangeAxis.setLowerMargin(0.01);
    rangeAxis.setUpperMargin(0.01);

    {
        final Font axisFont = config.getAxisFont();
        if (axisFont != null) {
            rangeAxis.setLabelFont(axisFont);
            plot.getRangeAxis().setLabelFont(axisFont);
        }
    }

    final String xaxisFmt = config.getAxisFormat();

    if (xaxisFmt == null || xaxisFmt.isEmpty()) {
        double diffInDays = (to.getTime() - from.getTime()) / (1000.0 * 60.0 * 60.0 * 24.0);
        if (diffInDays < 2)
            rangeAxis.setDateFormatOverride(
                    new SimpleDateFormat(Config.DEFAULT_TIMEFMT, DateFormatSymbols.getInstance()));
        else
            rangeAxis.setDateFormatOverride(
                    new SimpleDateFormat(Config.DEFAULT_SHORTTIMEFMT, DateFormatSymbols.getInstance()));
    } else
        rangeAxis.setDateFormatOverride(new SimpleDateFormat(xaxisFmt, DateFormatSymbols.getInstance()));

    final ValueAxis domain = plot.getRangeAxis();
    if (config.getForceYmin() != 0 || config.getForceYmax() != 0)
        domain.setRange(ElfValue.valueIntToDouble(config.getForceYmin()),
                ElfValue.valueIntToDouble(config.getForceYmax()));

    // title
    final Font titleFont = config.getTitleFont();
    if (titleFont != null)
        chart.getTitle().setFont(titleFont);

    return chart;
}

From source file:y.graphs.ChartHelperSRB.java

private static JFreeChart createChart(final TimeSeriesCollection dataset, Date from, Date to, Config config,
        ArrayList<ConfigSerie> series) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(Config.getResource("MsgTitleSrbGraph"),
            Config.getResource("TitleDate"), Config.getResource("MsgTitleSrbGraphYAxis"), dataset, true, // include legend
            true, // tooltips
            false // urls
    );/*from  ww  w.j ava 2s.com*/

    chart.setBackgroundPaint(Color.white);

    final XYPlot plot = chart.getXYPlot();
    LegendTitle lt = new LegendTitle(plot);
    lt.setItemFont(new Font("Dialog", Font.PLAIN, 12));
    lt.setBackgroundPaint(Color.white);
    lt.setFrame(new BlockBorder(Color.white));
    lt.setVerticalAlignment(VerticalAlignment.CENTER);
    XYTitleAnnotation ta = new XYTitleAnnotation(config.getLegendX(), config.getLegendY(), lt,
            RectangleAnchor.TOP_RIGHT);
    ta.setMaxWidth(config.getLegendSize());
    plot.addAnnotation(ta);
    chart.removeLegend();

    plot.setBackgroundPaint(config.getColorBackgroundSRB());
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    final Stroke lineStroke = new BasicStroke((float) config.getLineWidthSRB());

    for (int si = 0; si < series.size(); si++) {
        final ConfigSerie cs = series.get(si);
        renderer.setSeriesLinesVisible(si, cs.isDrawLine());

        final float size = cs.getShapeSize();
        renderer.setSeriesShapesVisible(si, size > 0);
        if (size > 0)
            renderer.setSeriesShape(si, ShapeUtilities.createRegularCross(size, size));

        renderer.setSeriesStroke(si, lineStroke);
        //          renderer.setSeriesOutlineStroke(si, lineStroke);
        renderer.setSeriesPaint(si, cs.getColor());
    }
    plot.setRenderer(renderer);

    // x axis
    final DateAxis rangeAxis = (DateAxis) plot.getDomainAxis();
    //      rangeAxis.setStandardTickUnits(DateAxis.createStandardDateTickUnits()); // Returns a collection of standard date tick units that uses the default time zone. This collection will be used by default, but you are free to create your own collection if you want to
    rangeAxis.setAutoRange(true);
    //        rangeAxis.setRange(from, to);
    rangeAxis.setLowerMargin(0.01);
    rangeAxis.setUpperMargin(0.01);

    {
        final Font axisFont = config.getAxisFont();
        if (axisFont != null) {
            rangeAxis.setLabelFont(axisFont);
            plot.getRangeAxis().setLabelFont(axisFont);
        }
    }

    final String xaxisFmt = config.getAxisFormat();

    if (xaxisFmt == null || xaxisFmt.isEmpty()) {
        double diffInDays = (to.getTime() - from.getTime()) / (1000.0 * 60.0 * 60.0 * 24.0);
        if (diffInDays < 2)
            rangeAxis.setDateFormatOverride(
                    new SimpleDateFormat(Config.DEFAULT_TIMEFMT, DateFormatSymbols.getInstance()));
        else
            rangeAxis.setDateFormatOverride(
                    new SimpleDateFormat(Config.DEFAULT_SHORTTIMEFMT, DateFormatSymbols.getInstance()));
    } else
        rangeAxis.setDateFormatOverride(new SimpleDateFormat(xaxisFmt, DateFormatSymbols.getInstance()));

    final ValueAxis domain = plot.getRangeAxis();
    if (config.getForceYmin() != 0 || config.getForceYmax() != 0)
        domain.setRange(ElfValue.valueIntToDouble(config.getForceYmin()),
                ElfValue.valueIntToDouble(config.getForceYmax()));

    // title
    final Font titleFont = config.getTitleFont();
    if (titleFont != null)
        chart.getTitle().setFont(titleFont);

    return chart;
}

From source file:uk.ac.lkl.cram.ui.chart.TLALearningTypeChartFactory.java

private static JFreeChart createChart(PieDataset dataset) {
    //Create a pie chart from the chart factory with no title, a legend and no tooltips
    JFreeChart chart = ChartFactory.createPieChart(null, dataset, true, false, false);
    //Set the background colour of the chart
    Paint backgroundPaint = Color.white;
    chart.setBackgroundPaint(backgroundPaint);
    //Get the plot from the chart
    PiePlot plot = (PiePlot) chart.getPlot();
    //Set the background colour of the plot to be the same as the chart
    plot.setBackgroundPaint(backgroundPaint);
    //Remove shadows from the plot
    plot.setShadowXOffset(0);/*from w  ww  .  jav a  2 s.  c  o m*/
    plot.setShadowYOffset(0);
    //Remove the outline from the plot
    plot.setOutlineVisible(false);
    //Remove the labels from the plot
    plot.setLabelGenerator(null);
    //Set the colours for the segments
    plot.setSectionPaint(LearningTypeChartMaker.ACQUISITION, LearningTypeChartMaker.ACQUISITION_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.COLLABORATION, LearningTypeChartMaker.COLLABORATION_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.DISCUSSION, LearningTypeChartMaker.DISCUSSION_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.INQUIRY, LearningTypeChartMaker.INQUIRY_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.PRACTICE, LearningTypeChartMaker.PRACTICE_COLOR);
    plot.setSectionPaint(LearningTypeChartMaker.PRODUCTION, LearningTypeChartMaker.PRODUCTION_COLOR);
    //Get the legend from the chart
    LegendTitle legend = chart.getLegend();
    //Set the font of the legend to be the same as the platform UI
    legend.setItemFont(UIManager.getFont("Label.font"));
    //Set the background colour of the legend to be the same as the chart
    legend.setBackgroundPaint(backgroundPaint);
    //Remove the border from the legend
    legend.setFrame(BlockBorder.NONE);
    //Locate the legend to the right of the plot
    legend.setPosition(RectangleEdge.RIGHT);
    return chart;
}

From source file:com.hmsinc.epicenter.webapp.chart.ChartService.java

/**
 * @param chart/*from ww  w.  j a  v  a 2 s .c o m*/
 * @return
 */
private static void configureTitleAndLegend(final JFreeChart chart, final AbstractChart adapter) {

    final TextTitle title = chart.getTitle();
    if (title != null) {
        title.setFont(new Font("Arial", Font.BOLD, 12));
        // title.setBackgroundPaint(Color.CYAN);
        title.setTextAlignment(HorizontalAlignment.LEFT);
        title.setHorizontalAlignment(HorizontalAlignment.CENTER);
        title.setMargin(0, 4, 5, 6);
    }

    if (chart.getLegend() != null) {
        chart.removeLegend();

        final LegendTitle legend = new LegendTitle(chart.getPlot(), new SNColumnArrangement(0, 0),
                new ColumnArrangement(HorizontalAlignment.CENTER, VerticalAlignment.CENTER, 0, 0));

        legend.setItemFont(LEGEND_FONT);
        legend.setPosition(RectangleEdge.BOTTOM);
        legend.setHorizontalAlignment(HorizontalAlignment.CENTER);
        legend.setBackgroundPaint(Color.WHITE);
        legend.setFrame(new LineBorder());
        legend.setMargin(0, 4, 5, 6);

        chart.addLegend(legend);

        // Now we'll try to remove any duplicate items from the legend..
        final Map<String, Integer> keys = new HashMap<String, Integer>();
        final LegendItemCollection items = new LegendItemCollection();

        for (LegendItemSource source : legend.getSources()) {

            for (int i = 0; i < source.getLegendItems().getItemCount(); i++) {

                final LegendItem item = source.getLegendItems().get(i);
                if (!keys.containsKey(item.getLabel())) {
                    keys.put(item.getLabel(), i);
                    items.add(item);
                }
            }
        }

        legend.setSources(new LegendItemSource[] { new LegendItemSource() {

            /*
             * (non-Javadoc)
             * 
             * @see org.jfree.chart.LegendItemSource#getLegendItems()
             */
            public LegendItemCollection getLegendItems() {
                return items;
            }

        } });
    }
}

From source file:edu.cudenver.bios.chartsvc.representation.LegendImageRepresentation.java

/**
 * Called internally by Restlet library to write the image as the HTTP
 * response.//from  w  w  w. j av  a2 s.  c o  m
 * @param out output stream
 */
@Override
public void write(OutputStream out) throws IOException {
    // build the legend from the plot, and write it to a jpeg image
    if (plot != null) {
        LegendTitle legend = new LegendTitle(plot, new ColumnArrangement(), new ColumnArrangement());
        legend.setFrame(BlockBorder.NONE);
        //legend.setMargin(new RectangleInsets(2.0, 2.0, 2.0, 2.0));
        legend.setBackgroundPaint(Color.white);
        legend.setPosition(RectangleEdge.BOTTOM);
        BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
        Graphics2D g = image.createGraphics();
        Rectangle2D.Double legendArea = new Rectangle2D.Double(0, 0, width, height);
        g.clip(legendArea);
        legend.arrange(g, new RectangleConstraint(width, height));
        legend.draw(g, legendArea);
        g.dispose();
        EncoderUtil.writeBufferedImage(image, ImageFormat.JPEG, out);
    }
}

From source file:com.intel.stl.ui.common.view.ComponentFactory.java

public static JFreeChart createTopNBarChart(String yAxisLabel, CategoryDataset dataset) {
    JFreeChart jfreechart = ChartFactory.createBarChart(null, null, yAxisLabel, dataset,
            PlotOrientation.HORIZONTAL, true, true, false);
    CategoryPlot categoryplot = jfreechart.getCategoryPlot();
    categoryplot.setBackgroundPaint(null);
    categoryplot.setOutlinePaint(null);/*from www. jav  a2s . com*/
    categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    categoryplot.setRangePannable(true);
    categoryplot.setRangeGridlinesVisible(true);
    categoryplot.setRangeGridlinePaint(UIConstants.INTEL_DARK_GRAY);

    BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();
    barrenderer.setBarPainter(new StandardBarPainter());
    barrenderer.setShadowVisible(false);
    barrenderer.setItemMargin(0.015);
    barrenderer.setSeriesPaint(0, UIConstants.INTEL_BLUE);
    barrenderer.setSeriesPaint(1, UIConstants.INTEL_LIGHT_BLUE);

    CategoryAxis categoryaxis = categoryplot.getDomainAxis();
    categoryaxis.setCategoryMargin(0.15D);
    categoryaxis.setUpperMargin(0.02D);
    categoryaxis.setLowerMargin(0.02D);
    categoryaxis.setMaximumCategoryLabelWidthRatio(0.5F);

    NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();
    numberaxis.setRangeType(RangeType.POSITIVE);
    numberaxis.setStandardTickUnits(createLargeNumberTickUnits());
    numberaxis.setUpperMargin(0.20000000000000001D);
    numberaxis.setLabelFont(UIConstants.H5_FONT);
    numberaxis.setLabelInsets(new RectangleInsets(0, 0, 0, 0));
    numberaxis.setTickMarksVisible(true);
    numberaxis.setTickLabelsVisible(true);

    LegendTitle legend = jfreechart.getLegend();
    legend.setFrame(BlockBorder.NONE);
    legend.setItemFont(barrenderer.getBaseItemLabelFont().deriveFont(10.0f));

    return jfreechart;
}