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

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

Introduction

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

Prototype

@Override
public Object draw(Graphics2D g2, Rectangle2D area, Object params) 

Source Link

Document

Draws the block within the specified area.

Usage

From source file:org.logisticPlanning.utils.graphics.chart.impl.jfree._JFCLineChart2D.java

/**
 * paint a legend//  w  w  w.  j  a v a2  s. c om
 *
 * @param legend
 *          the legend
 * @param graphics
 *          the graphics
 * @param bounds
 *          the bounds
 */
private static final void __paintLegend(final LegendTitle legend, final Graphics2D graphics,
        final Rectangle2D bounds) {
    final Rectangle2D titleArea;
    final BlockParams p;
    final double ww, hh;
    final RectangleConstraint constraint;
    final Size2D size;

    p = new BlockParams();
    p.setGenerateEntities(false);

    ww = bounds.getWidth();
    if (ww <= 0.0d) {
        return;
    }
    hh = bounds.getHeight();
    if (hh <= 0.0d) {
        return;
    }

    constraint = new RectangleConstraint(ww, new Range(0.0, ww), LengthConstraintType.RANGE, hh,
            new Range(0.0, hh), LengthConstraintType.RANGE);

    size = legend.arrange(graphics, constraint);
    titleArea = _JFCLineChart2D.__createAlignedRectangle2D(size, bounds, legend.getHorizontalAlignment(),
            VerticalAlignment.TOP);
    legend.setMargin(_JFCLineChart2D.LEGEND_MARGIN);
    legend.setPadding(_JFCLineChart2D.CHART_INSETS);
    legend.draw(graphics, titleArea, p);
}