Java Code Examples for org.jfree.chart.plot.CategoryPlot#drawBackgroundImage()

The following examples show how to use org.jfree.chart.plot.CategoryPlot#drawBackgroundImage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineRenderer3D.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 2
Source File: BarRenderer3D.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
        Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 3
Source File: LineRenderer3D.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 4
Source File: BarRenderer3D.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
        Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 5
Source File: LineRenderer3D.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 6
Source File: BarRenderer3D.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
        Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 7
Source File: LineRenderer3D.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 8
Source File: BarRenderer3D.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
        Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 9
Source File: LineRenderer3D.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 10
Source File: BarRenderer3D.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 11
Source File: LineRenderer3D.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
public void drawBackground(Graphics2D g2, CategoryPlot plot, 
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX() 
                + getXOffset(), dataArea.getY(), 
                dataArea.getWidth() - getXOffset(), 
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }
    
    g2.setComposite(originalComposite);

}
 
Example 12
Source File: BarRenderer3D.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
public void drawBackground(Graphics2D g2, CategoryPlot plot, 
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));
    
    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);
            
    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX() 
                + getXOffset(), dataArea.getY(), 
                dataArea.getWidth() - getXOffset(), 
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }
    
    g2.setComposite(originalComposite);

}
 
Example 13
Source File: LineRenderer3D.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 14
Source File: BarRenderer3D.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
        Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 15
Source File: LineRenderer3D.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
                           Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // higlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}
 
Example 16
Source File: BarRenderer3D.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draws the background for the plot.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the area inside the axes.
 */
@Override
public void drawBackground(Graphics2D g2, CategoryPlot plot,
        Rectangle2D dataArea) {

    float x0 = (float) dataArea.getX();
    float x1 = x0 + (float) Math.abs(this.xOffset);
    float x3 = (float) dataArea.getMaxX();
    float x2 = x3 - (float) Math.abs(this.xOffset);

    float y0 = (float) dataArea.getMaxY();
    float y1 = y0 - (float) Math.abs(this.yOffset);
    float y3 = (float) dataArea.getMinY();
    float y2 = y3 + (float) Math.abs(this.yOffset);

    GeneralPath clip = new GeneralPath();
    clip.moveTo(x0, y0);
    clip.lineTo(x0, y2);
    clip.lineTo(x1, y3);
    clip.lineTo(x3, y3);
    clip.lineTo(x3, y1);
    clip.lineTo(x2, y0);
    clip.closePath();

    Composite originalComposite = g2.getComposite();
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            plot.getBackgroundAlpha()));

    // fill background...
    Paint backgroundPaint = plot.getBackgroundPaint();
    if (backgroundPaint != null) {
        g2.setPaint(backgroundPaint);
        g2.fill(clip);
    }

    GeneralPath leftWall = new GeneralPath();
    leftWall.moveTo(x0, y0);
    leftWall.lineTo(x0, y2);
    leftWall.lineTo(x1, y3);
    leftWall.lineTo(x1, y1);
    leftWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(leftWall);

    GeneralPath bottomWall = new GeneralPath();
    bottomWall.moveTo(x0, y0);
    bottomWall.lineTo(x1, y1);
    bottomWall.lineTo(x3, y1);
    bottomWall.lineTo(x2, y0);
    bottomWall.closePath();
    g2.setPaint(getWallPaint());
    g2.fill(bottomWall);

    // highlight the background corners...
    g2.setPaint(Color.lightGray);
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    g2.draw(corner);
    corner.setLine(x1, y1, x1, y3);
    g2.draw(corner);
    corner.setLine(x1, y1, x3, y1);
    g2.draw(corner);

    // draw background image, if there is one...
    Image backgroundImage = plot.getBackgroundImage();
    if (backgroundImage != null) {
        Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
                + getXOffset(), dataArea.getY(),
                dataArea.getWidth() - getXOffset(),
                dataArea.getHeight() - getYOffset());
        plot.drawBackgroundImage(g2, adjusted);
    }

    g2.setComposite(originalComposite);

}