Search in sources :

Example 26 with Composite

use of java.awt.Composite in project SIMVA-SoS by SESoS.

the class MeterPlot method draw.

/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects info about the drawing.
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) {
    if (info != null) {
        info.setPlotArea(area);
    }
    // adjust for insets...
    RectangleInsets insets = getInsets();
    insets.trim(area);
    area.setRect(area.getX() + 4, area.getY() + 4, area.getWidth() - 8, area.getHeight() - 8);
    // draw the background
    if (this.drawBorder) {
        drawBackground(g2, area);
    }
    // adjust the plot area by the interior spacing value
    double gapHorizontal = (2 * DEFAULT_BORDER_SIZE);
    double gapVertical = (2 * DEFAULT_BORDER_SIZE);
    double meterX = area.getX() + gapHorizontal / 2;
    double meterY = area.getY() + gapVertical / 2;
    double meterW = area.getWidth() - gapHorizontal;
    double meterH = area.getHeight() - gapVertical + ((this.meterAngle <= 180) && (this.shape != DialShape.CIRCLE) ? area.getHeight() / 1.25 : 0);
    double min = Math.min(meterW, meterH) / 2;
    meterX = (meterX + meterX + meterW) / 2 - min;
    meterY = (meterY + meterY + meterH) / 2 - min;
    meterW = 2 * min;
    meterH = 2 * min;
    Rectangle2D meterArea = new Rectangle2D.Double(meterX, meterY, meterW, meterH);
    Rectangle2D.Double originalArea = new Rectangle2D.Double(meterArea.getX() - 4, meterArea.getY() - 4, meterArea.getWidth() + 8, meterArea.getHeight() + 8);
    double meterMiddleX = meterArea.getCenterX();
    double meterMiddleY = meterArea.getCenterY();
    // plot the data (unless the dataset is null)...
    ValueDataset data = getDataset();
    if (data != null) {
        double dataMin = this.range.getLowerBound();
        double dataMax = this.range.getUpperBound();
        Shape savedClip = g2.getClip();
        g2.clip(originalArea);
        Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha()));
        if (this.dialBackgroundPaint != null) {
            fillArc(g2, originalArea, dataMin, dataMax, this.dialBackgroundPaint, true);
        }
        drawTicks(g2, meterArea, dataMin, dataMax);
        drawArcForInterval(g2, meterArea, new MeterInterval("", this.range, this.dialOutlinePaint, new BasicStroke(1.0f), null));
        Iterator iterator = this.intervals.iterator();
        while (iterator.hasNext()) {
            MeterInterval interval = (MeterInterval) iterator.next();
            drawArcForInterval(g2, meterArea, interval);
        }
        Number n = data.getValue();
        if (n != null) {
            double value = n.doubleValue();
            drawValueLabel(g2, meterArea);
            if (this.range.contains(value)) {
                g2.setPaint(this.needlePaint);
                g2.setStroke(new BasicStroke(2.0f));
                double radius = (meterArea.getWidth() / 2) + DEFAULT_BORDER_SIZE + 15;
                double valueAngle = valueToAngle(value);
                double valueP1 = meterMiddleX + (radius * Math.cos(Math.PI * (valueAngle / 180)));
                double valueP2 = meterMiddleY - (radius * Math.sin(Math.PI * (valueAngle / 180)));
                Polygon arrow = new Polygon();
                if ((valueAngle > 135 && valueAngle < 225) || (valueAngle < 45 && valueAngle > -45)) {
                    double valueP3 = (meterMiddleY - DEFAULT_CIRCLE_SIZE / 4);
                    double valueP4 = (meterMiddleY + DEFAULT_CIRCLE_SIZE / 4);
                    arrow.addPoint((int) meterMiddleX, (int) valueP3);
                    arrow.addPoint((int) meterMiddleX, (int) valueP4);
                } else {
                    arrow.addPoint((int) (meterMiddleX - DEFAULT_CIRCLE_SIZE / 4), (int) meterMiddleY);
                    arrow.addPoint((int) (meterMiddleX + DEFAULT_CIRCLE_SIZE / 4), (int) meterMiddleY);
                }
                arrow.addPoint((int) valueP1, (int) valueP2);
                g2.fill(arrow);
                Ellipse2D circle = new Ellipse2D.Double(meterMiddleX - DEFAULT_CIRCLE_SIZE / 2, meterMiddleY - DEFAULT_CIRCLE_SIZE / 2, DEFAULT_CIRCLE_SIZE, DEFAULT_CIRCLE_SIZE);
                g2.fill(circle);
            }
        }
        g2.setClip(savedClip);
        g2.setComposite(originalComposite);
    }
    if (this.drawBorder) {
        drawOutline(g2, area);
    }
}
Also used : BasicStroke(java.awt.BasicStroke) Shape(java.awt.Shape) AlphaComposite(java.awt.AlphaComposite) Composite(java.awt.Composite) Rectangle2D(java.awt.geom.Rectangle2D) ValueDataset(org.jfree.data.general.ValueDataset) Ellipse2D(java.awt.geom.Ellipse2D) Iterator(java.util.Iterator) RectangleInsets(org.jfree.ui.RectangleInsets) Polygon(java.awt.Polygon)

Example 27 with Composite

use of java.awt.Composite in project SIMVA-SoS by SESoS.

the class ChartPanel method paintComponent.

/**
 * Paints the component by drawing the chart to fill the entire component,
 * but allowing for the insets (which will be non-zero if a border has been
 * set for this component).  To increase performance (at the expense of
 * memory), an off-screen buffer image can be used.
 *
 * @param g  the graphics device for drawing on.
 */
@Override
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (this.chart == null) {
        return;
    }
    Graphics2D g2 = (Graphics2D) g.create();
    // first determine the size of the chart rendering area...
    Dimension size = getSize();
    Insets insets = getInsets();
    Rectangle2D available = new Rectangle2D.Double(insets.left, insets.top, size.getWidth() - insets.left - insets.right, size.getHeight() - insets.top - insets.bottom);
    // work out if scaling is required...
    boolean scale = false;
    double drawWidth = available.getWidth();
    double drawHeight = available.getHeight();
    this.scaleX = 1.0;
    this.scaleY = 1.0;
    if (drawWidth < this.minimumDrawWidth) {
        this.scaleX = drawWidth / this.minimumDrawWidth;
        drawWidth = this.minimumDrawWidth;
        scale = true;
    } else if (drawWidth > this.maximumDrawWidth) {
        this.scaleX = drawWidth / this.maximumDrawWidth;
        drawWidth = this.maximumDrawWidth;
        scale = true;
    }
    if (drawHeight < this.minimumDrawHeight) {
        this.scaleY = drawHeight / this.minimumDrawHeight;
        drawHeight = this.minimumDrawHeight;
        scale = true;
    } else if (drawHeight > this.maximumDrawHeight) {
        this.scaleY = drawHeight / this.maximumDrawHeight;
        drawHeight = this.maximumDrawHeight;
        scale = true;
    }
    Rectangle2D chartArea = new Rectangle2D.Double(0.0, 0.0, drawWidth, drawHeight);
    // are we using the chart buffer?
    if (this.useBuffer) {
        // do we need to resize the buffer?
        if ((this.chartBuffer == null) || (this.chartBufferWidth != available.getWidth()) || (this.chartBufferHeight != available.getHeight())) {
            this.chartBufferWidth = (int) available.getWidth();
            this.chartBufferHeight = (int) available.getHeight();
            GraphicsConfiguration gc = g2.getDeviceConfiguration();
            this.chartBuffer = gc.createCompatibleImage(this.chartBufferWidth, this.chartBufferHeight, Transparency.TRANSLUCENT);
            this.refreshBuffer = true;
        }
        // do we need to redraw the buffer?
        if (this.refreshBuffer) {
            // clear the flag
            this.refreshBuffer = false;
            Rectangle2D bufferArea = new Rectangle2D.Double(0, 0, this.chartBufferWidth, this.chartBufferHeight);
            // make the background of the buffer clear and transparent
            Graphics2D bufferG2 = (Graphics2D) this.chartBuffer.getGraphics();
            Composite savedComposite = bufferG2.getComposite();
            bufferG2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR, 0.0f));
            Rectangle r = new Rectangle(0, 0, this.chartBufferWidth, this.chartBufferHeight);
            bufferG2.fill(r);
            bufferG2.setComposite(savedComposite);
            if (scale) {
                AffineTransform saved = bufferG2.getTransform();
                AffineTransform st = AffineTransform.getScaleInstance(this.scaleX, this.scaleY);
                bufferG2.transform(st);
                this.chart.draw(bufferG2, chartArea, this.anchor, this.info);
                bufferG2.setTransform(saved);
            } else {
                this.chart.draw(bufferG2, bufferArea, this.anchor, this.info);
            }
        }
        // zap the buffer onto the panel...
        g2.drawImage(this.chartBuffer, insets.left, insets.top, this);
    } else {
        // redrawing the chart every time...
        AffineTransform saved = g2.getTransform();
        g2.translate(insets.left, insets.top);
        if (scale) {
            AffineTransform st = AffineTransform.getScaleInstance(this.scaleX, this.scaleY);
            g2.transform(st);
        }
        this.chart.draw(g2, chartArea, this.anchor, this.info);
        g2.setTransform(saved);
    }
    Iterator iterator = this.overlays.iterator();
    while (iterator.hasNext()) {
        Overlay overlay = (Overlay) iterator.next();
        overlay.paintOverlay(g2, this);
    }
    // redraw the zoom rectangle (if present) - if useBuffer is false,
    // we use XOR so we can XOR the rectangle away again without redrawing
    // the chart
    drawZoomRectangle(g2, !this.useBuffer);
    g2.dispose();
    this.anchor = null;
    this.verticalTraceLine = null;
    this.horizontalTraceLine = null;
}
Also used : Insets(java.awt.Insets) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) Rectangle2D(java.awt.geom.Rectangle2D) Rectangle(java.awt.Rectangle) Dimension(java.awt.Dimension) Graphics2D(java.awt.Graphics2D) GraphicsConfiguration(java.awt.GraphicsConfiguration) Iterator(java.util.Iterator) AffineTransform(java.awt.geom.AffineTransform) Overlay(org.jfree.chart.panel.Overlay)

Example 28 with Composite

use of java.awt.Composite in project SIMVA-SoS by SESoS.

the class AbstractCategoryItemRenderer method drawRangeMarker.

/**
 * Draws a marker for the range axis.
 *
 * @param g2  the graphics device (not <code>null</code>).
 * @param plot  the plot (not <code>null</code>).
 * @param axis  the range axis (not <code>null</code>).
 * @param marker  the marker to be drawn (not <code>null</code>).
 * @param dataArea  the area inside the axes (not <code>null</code>).
 *
 * @see #drawDomainMarker(Graphics2D, CategoryPlot, CategoryAxis,
 *     CategoryMarker, Rectangle2D)
 */
@Override
public void drawRangeMarker(Graphics2D g2, CategoryPlot plot, ValueAxis axis, Marker marker, Rectangle2D dataArea) {
    if (marker instanceof ValueMarker) {
        ValueMarker vm = (ValueMarker) marker;
        double value = vm.getValue();
        Range range = axis.getRange();
        if (!range.contains(value)) {
            return;
        }
        final Composite savedComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, marker.getAlpha()));
        PlotOrientation orientation = plot.getOrientation();
        double v = axis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());
        Line2D line = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
        } else if (orientation == PlotOrientation.VERTICAL) {
            line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v);
        } else {
            throw new IllegalStateException();
        }
        g2.setPaint(marker.getPaint());
        g2.setStroke(marker.getStroke());
        g2.draw(line);
        String label = marker.getLabel();
        RectangleAnchor anchor = marker.getLabelAnchor();
        if (label != null) {
            Font labelFont = marker.getLabelFont();
            g2.setFont(labelFont);
            Point2D coordinates = calculateRangeMarkerTextAnchorPoint(g2, orientation, dataArea, line.getBounds2D(), marker.getLabelOffset(), LengthAdjustmentType.EXPAND, anchor);
            Rectangle2D rect = TextUtils.calcAlignedStringBounds(label, g2, (float) coordinates.getX(), (float) coordinates.getY(), marker.getLabelTextAnchor());
            g2.setPaint(marker.getLabelBackgroundColor());
            g2.fill(rect);
            g2.setPaint(marker.getLabelPaint());
            TextUtils.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(), marker.getLabelTextAnchor());
        }
        g2.setComposite(savedComposite);
    } else if (marker instanceof IntervalMarker) {
        IntervalMarker im = (IntervalMarker) marker;
        double start = im.getStartValue();
        double end = im.getEndValue();
        Range range = axis.getRange();
        if (!(range.intersects(start, end))) {
            return;
        }
        final Composite savedComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, marker.getAlpha()));
        double start2d = axis.valueToJava2D(start, dataArea, plot.getRangeAxisEdge());
        double end2d = axis.valueToJava2D(end, dataArea, plot.getRangeAxisEdge());
        double low = Math.min(start2d, end2d);
        double high = Math.max(start2d, end2d);
        PlotOrientation orientation = plot.getOrientation();
        Rectangle2D rect = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
            // clip left and right bounds to data area
            low = Math.max(low, dataArea.getMinX());
            high = Math.min(high, dataArea.getMaxX());
            rect = new Rectangle2D.Double(low, dataArea.getMinY(), high - low, dataArea.getHeight());
        } else if (orientation == PlotOrientation.VERTICAL) {
            // clip top and bottom bounds to data area
            low = Math.max(low, dataArea.getMinY());
            high = Math.min(high, dataArea.getMaxY());
            rect = new Rectangle2D.Double(dataArea.getMinX(), low, dataArea.getWidth(), high - low);
        }
        Paint p = marker.getPaint();
        if (p instanceof GradientPaint) {
            GradientPaint gp = (GradientPaint) p;
            GradientPaintTransformer t = im.getGradientPaintTransformer();
            if (t != null) {
                gp = t.transform(gp, rect);
            }
            g2.setPaint(gp);
        } else {
            g2.setPaint(p);
        }
        g2.fill(rect);
        // now draw the outlines, if visible...
        if (im.getOutlinePaint() != null && im.getOutlineStroke() != null) {
            if (orientation == PlotOrientation.VERTICAL) {
                Line2D line = new Line2D.Double();
                double x0 = dataArea.getMinX();
                double x1 = dataArea.getMaxX();
                g2.setPaint(im.getOutlinePaint());
                g2.setStroke(im.getOutlineStroke());
                if (range.contains(start)) {
                    line.setLine(x0, start2d, x1, start2d);
                    g2.draw(line);
                }
                if (range.contains(end)) {
                    line.setLine(x0, end2d, x1, end2d);
                    g2.draw(line);
                }
            } else {
                // PlotOrientation.HORIZONTAL
                Line2D line = new Line2D.Double();
                double y0 = dataArea.getMinY();
                double y1 = dataArea.getMaxY();
                g2.setPaint(im.getOutlinePaint());
                g2.setStroke(im.getOutlineStroke());
                if (range.contains(start)) {
                    line.setLine(start2d, y0, start2d, y1);
                    g2.draw(line);
                }
                if (range.contains(end)) {
                    line.setLine(end2d, y0, end2d, y1);
                    g2.draw(line);
                }
            }
        }
        String label = marker.getLabel();
        RectangleAnchor anchor = marker.getLabelAnchor();
        if (label != null) {
            Font labelFont = marker.getLabelFont();
            g2.setFont(labelFont);
            g2.setPaint(marker.getLabelPaint());
            Point2D coordinates = calculateRangeMarkerTextAnchorPoint(g2, orientation, dataArea, rect, marker.getLabelOffset(), marker.getLabelOffsetType(), anchor);
            TextUtilities.drawAlignedString(label, g2, (float) coordinates.getX(), (float) coordinates.getY(), marker.getLabelTextAnchor());
        }
        g2.setComposite(savedComposite);
    }
}
Also used : PlotOrientation(org.jfree.chart.plot.PlotOrientation) GradientPaintTransformer(org.jfree.ui.GradientPaintTransformer) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) Rectangle2D(java.awt.geom.Rectangle2D) GradientPaint(java.awt.GradientPaint) RectangleAnchor(org.jfree.ui.RectangleAnchor) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint) Range(org.jfree.data.Range) Line2D(java.awt.geom.Line2D) Font(java.awt.Font) Point2D(java.awt.geom.Point2D) IntervalMarker(org.jfree.chart.plot.IntervalMarker) ValueMarker(org.jfree.chart.plot.ValueMarker)

Example 29 with Composite

use of java.awt.Composite in project SIMVA-SoS by SESoS.

the class PolarPlot method draw.

/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).
 * <P>
 * This plot relies on a {@link PolarItemRenderer} to draw each
 * item in the plot.  This allows the visual representation of the data to
 * be changed easily.
 * <P>
 * The optional info argument collects information about the rendering of
 * the plot (dimensions, tooltip information etc).  Just pass in
 * <code>null</code> if you do not need this information.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axes and
 *              labels) should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  ignored.
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) {
    // if the plot area is too small, just return...
    boolean b1 = (area.getWidth() <= MINIMUM_WIDTH_TO_DRAW);
    boolean b2 = (area.getHeight() <= MINIMUM_HEIGHT_TO_DRAW);
    if (b1 || b2) {
        return;
    }
    // record the plot area...
    if (info != null) {
        info.setPlotArea(area);
    }
    // adjust the drawing area for the plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);
    Rectangle2D dataArea = area;
    if (info != null) {
        info.setDataArea(dataArea);
    }
    // draw the plot background and axes...
    drawBackground(g2, dataArea);
    int axisCount = this.axes.size();
    AxisState state = null;
    for (int i = 0; i < axisCount; i++) {
        ValueAxis axis = getAxis(i);
        if (axis != null) {
            PolarAxisLocation location = (PolarAxisLocation) this.axisLocations.get(i);
            AxisState s = this.drawAxis(axis, location, g2, dataArea);
            if (i == 0) {
                state = s;
            }
        }
    }
    // now for each dataset, get the renderer and the appropriate axis
    // and render the dataset...
    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();
    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha()));
    this.angleTicks = refreshAngleTicks();
    drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());
    render(g2, dataArea, info);
    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);
    drawCornerTextItems(g2, dataArea);
}
Also used : AxisState(org.jfree.chart.axis.AxisState) Shape(java.awt.Shape) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) ValueAxis(org.jfree.chart.axis.ValueAxis) Rectangle2D(java.awt.geom.Rectangle2D) RectangleInsets(org.jfree.ui.RectangleInsets) Point(java.awt.Point) Paint(java.awt.Paint)

Example 30 with Composite

use of java.awt.Composite in project SIMVA-SoS by SESoS.

the class XYPlot method drawQuadrants.

/**
 * Draws the quadrants.
 *
 * @param g2  the graphics device.
 * @param area  the area.
 *
 * @see #setQuadrantOrigin(Point2D)
 * @see #setQuadrantPaint(int, Paint)
 */
protected void drawQuadrants(Graphics2D g2, Rectangle2D area) {
    // 0 | 1
    // --+--
    // 2 | 3
    boolean somethingToDraw = false;
    ValueAxis xAxis = getDomainAxis();
    if (xAxis == null) {
        // we can't draw quadrants without a valid x-axis
        return;
    }
    double x = xAxis.getRange().constrain(this.quadrantOrigin.getX());
    double xx = xAxis.valueToJava2D(x, area, getDomainAxisEdge());
    ValueAxis yAxis = getRangeAxis();
    if (yAxis == null) {
        // we can't draw quadrants without a valid y-axis
        return;
    }
    double y = yAxis.getRange().constrain(this.quadrantOrigin.getY());
    double yy = yAxis.valueToJava2D(y, area, getRangeAxisEdge());
    double xmin = xAxis.getLowerBound();
    double xxmin = xAxis.valueToJava2D(xmin, area, getDomainAxisEdge());
    double xmax = xAxis.getUpperBound();
    double xxmax = xAxis.valueToJava2D(xmax, area, getDomainAxisEdge());
    double ymin = yAxis.getLowerBound();
    double yymin = yAxis.valueToJava2D(ymin, area, getRangeAxisEdge());
    double ymax = yAxis.getUpperBound();
    double yymax = yAxis.valueToJava2D(ymax, area, getRangeAxisEdge());
    Rectangle2D[] r = new Rectangle2D[] { null, null, null, null };
    if (this.quadrantPaint[0] != null) {
        if (x > xmin && y < ymax) {
            if (this.orientation == PlotOrientation.HORIZONTAL) {
                r[0] = new Rectangle2D.Double(Math.min(yymax, yy), Math.min(xxmin, xx), Math.abs(yy - yymax), Math.abs(xx - xxmin));
            } else {
                // PlotOrientation.VERTICAL
                r[0] = new Rectangle2D.Double(Math.min(xxmin, xx), Math.min(yymax, yy), Math.abs(xx - xxmin), Math.abs(yy - yymax));
            }
            somethingToDraw = true;
        }
    }
    if (this.quadrantPaint[1] != null) {
        if (x < xmax && y < ymax) {
            if (this.orientation == PlotOrientation.HORIZONTAL) {
                r[1] = new Rectangle2D.Double(Math.min(yymax, yy), Math.min(xxmax, xx), Math.abs(yy - yymax), Math.abs(xx - xxmax));
            } else {
                // PlotOrientation.VERTICAL
                r[1] = new Rectangle2D.Double(Math.min(xx, xxmax), Math.min(yymax, yy), Math.abs(xx - xxmax), Math.abs(yy - yymax));
            }
            somethingToDraw = true;
        }
    }
    if (this.quadrantPaint[2] != null) {
        if (x > xmin && y > ymin) {
            if (this.orientation == PlotOrientation.HORIZONTAL) {
                r[2] = new Rectangle2D.Double(Math.min(yymin, yy), Math.min(xxmin, xx), Math.abs(yy - yymin), Math.abs(xx - xxmin));
            } else {
                // PlotOrientation.VERTICAL
                r[2] = new Rectangle2D.Double(Math.min(xxmin, xx), Math.min(yymin, yy), Math.abs(xx - xxmin), Math.abs(yy - yymin));
            }
            somethingToDraw = true;
        }
    }
    if (this.quadrantPaint[3] != null) {
        if (x < xmax && y > ymin) {
            if (this.orientation == PlotOrientation.HORIZONTAL) {
                r[3] = new Rectangle2D.Double(Math.min(yymin, yy), Math.min(xxmax, xx), Math.abs(yy - yymin), Math.abs(xx - xxmax));
            } else {
                // PlotOrientation.VERTICAL
                r[3] = new Rectangle2D.Double(Math.min(xx, xxmax), Math.min(yymin, yy), Math.abs(xx - xxmax), Math.abs(yy - yymin));
            }
            somethingToDraw = true;
        }
    }
    if (somethingToDraw) {
        Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getBackgroundAlpha()));
        for (int i = 0; i < 4; i++) {
            if (this.quadrantPaint[i] != null && r[i] != null) {
                g2.setPaint(this.quadrantPaint[i]);
                g2.fill(r[i]);
            }
        }
        g2.setComposite(originalComposite);
    }
}
Also used : Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) ValueAxis(org.jfree.chart.axis.ValueAxis) Rectangle2D(java.awt.geom.Rectangle2D) Paint(java.awt.Paint)

Aggregations

Composite (java.awt.Composite)248 AlphaComposite (java.awt.AlphaComposite)236 Graphics2D (java.awt.Graphics2D)120 Paint (java.awt.Paint)80 Rectangle2D (java.awt.geom.Rectangle2D)80 Color (java.awt.Color)76 Shape (java.awt.Shape)64 BasicStroke (java.awt.BasicStroke)47 Stroke (java.awt.Stroke)44 BufferedImage (java.awt.image.BufferedImage)42 AffineTransform (java.awt.geom.AffineTransform)33 Point (java.awt.Point)32 Line2D (java.awt.geom.Line2D)30 Font (java.awt.Font)28 Point2D (java.awt.geom.Point2D)24 Rectangle (java.awt.Rectangle)23 GradientPaint (java.awt.GradientPaint)22 GeneralPath (java.awt.geom.GeneralPath)20 RectangleInsets (org.jfree.ui.RectangleInsets)20 FontMetrics (java.awt.FontMetrics)19