Example usage for org.jfree.chart.block RectangleConstraint RectangleConstraint

List of usage examples for org.jfree.chart.block RectangleConstraint RectangleConstraint

Introduction

In this page you can find the example usage for org.jfree.chart.block RectangleConstraint RectangleConstraint.

Prototype

public RectangleConstraint(double w, Range widthRange, LengthConstraintType widthConstraintType, double h,
        Range heightRange, LengthConstraintType heightConstraintType) 

Source Link

Document

Creates a new constraint.

Usage

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

/**
 * paint a legend//from  w w w .  j  av  a2s.  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);
}