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

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

Introduction

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

Prototype

public void setLegendItemGraphicLocation(RectangleAnchor anchor) 

Source Link

Document

Sets the legend item graphic location.

Usage

From source file:lucee.runtime.tag.Chart.java

private void setLegend(JFreeChart chart, Plot plot, Font font) {
    if (!showlegend)
        return;//  w ww . j  a  v a2  s  .  co m

    Color bg = backgroundcolor == null ? databackgroundcolor : backgroundcolor;
    if (font == null)
        font = getFont();

    LegendTitle legend = legendMultiLine
            ? new LegendTitle(plot, new ColumnArrangement(), new ColumnArrangement())
            : new LegendTitle(plot);
    legend.setBackgroundPaint(bg);
    legend.setMargin(new RectangleInsets(1.0, 1.0, 1.0, 1.0));
    legend.setFrame(new LineBorder());
    legend.setPosition(RectangleEdge.BOTTOM);
    legend.setHorizontalAlignment(HorizontalAlignment.LEFT);

    legend.setWidth(chartwidth - 20);// geht nicht
    legend.setItemFont(font);
    legend.setItemPaint(foregroundcolor);

    //RectangleInsets labelPadding;
    legend.setItemLabelPadding(new RectangleInsets(2, 2, 2, 2));
    legend.setBorder(0, 0, 0, 0);
    legend.setLegendItemGraphicLocation(RectangleAnchor.TOP_LEFT);
    legend.setLegendItemGraphicPadding(new RectangleInsets(8, 10, 0, 0));
    chart.addLegend(legend);

}