Example usage for java.awt.geom Rectangle2D getWidth

List of usage examples for java.awt.geom Rectangle2D getWidth

Introduction

In this page you can find the example usage for java.awt.geom Rectangle2D getWidth.

Prototype

public abstract double getWidth();

Source Link

Document

Returns the width of the framing rectangle in double precision.

Usage

From source file:edu.pitt.dbmi.odie.ui.jfreechart.EnhancedChartComposite.java

/**
 * Returns the data area for the chart (the area inside the axes) with the
 * current scaling applied (that is, the area as it appears on screen).
 * //from  ww  w . j  a  v a  2 s.com
 * @return The scaled data area.
 */
public Rectangle getScreenDataArea() {
    Rectangle2D dataArea = this.info.getPlotInfo().getDataArea();
    Rectangle clientArea = this.getClientArea();

    int x = (int) Math.round((dataArea.getX() * this.scaleX + clientArea.x));
    int y = (int) Math.round((dataArea.getY() * this.scaleY + clientArea.y));
    int w = (int) Math.round((dataArea.getWidth() * this.scaleX));
    int h = (int) Math.round((dataArea.getHeight() * this.scaleY));

    return new Rectangle(x, y, w, h);
}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * Applies any scaling that is in effect for the chart drawing to the given rectangle.
 * /*from w w  w  .  j a  v  a  2  s  .c o  m*/
 * @param rect
 *            the rectangle.
 * @return A new scaled rectangle.
 */
public Rectangle2D scale(Rectangle2D rect) {
    Insets insets = getInsets();
    double x = rect.getX() * getScaleX() + insets.left;
    double y = rect.getY() * this.getScaleY() + insets.top;
    double w = rect.getWidth() * this.getScaleX();
    double h = rect.getHeight() * this.getScaleY();
    return new Rectangle2D.Double(x, y, w, h);
}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * Returns the data area for the chart (the area inside the axes) with the current scaling
 * applied (that is, the area as it appears on screen).
 * /*w  ww .  ja  v  a2 s . c  o m*/
 * @return The scaled data area.
 */
public Rectangle2D getScreenDataArea() {
    Rectangle2D dataArea = this.info.getPlotInfo().getDataArea();
    Insets insets = getInsets();
    double x = dataArea.getX() * this.scaleX + insets.left;
    double y = dataArea.getY() * this.scaleY + insets.top;
    double w = dataArea.getWidth() * this.scaleX;
    double h = dataArea.getHeight() * this.scaleY;
    return new Rectangle2D.Double(x, y, w, h);
}

From source file:org.rdv.viz.chart.ChartPanel.java

/**
 * Applies any scaling that is in effect for the chart drawing to the
 * given rectangle./*from   w  ww. j ava2s  .  c  o  m*/
 *
 * @param rect  the rectangle (<code>null</code> not permitted).
 *
 * @return A new scaled rectangle.
 */
public Rectangle2D scale(Rectangle2D rect) {
    Insets insets = getInsets();
    double x = rect.getX() * getScaleX() + insets.left;
    double y = rect.getY() * getScaleY() + insets.top;
    double w = rect.getWidth() * getScaleX();
    double h = rect.getHeight() * getScaleY();
    return new Rectangle2D.Double(x, y, w, h);
}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * 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.
 * /*from  ww w  . java  2 s  . c  om*/
 * @param g
 *            the graphics device for drawing on.
 */
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();
            this.chartBuffer = new BufferedImage(this.chartBufferWidth, this.chartBufferHeight,
                    BufferedImage.TYPE_INT_RGB);
            //this.chartBuffer = createImage(this.chartBufferWidth, this.chartBufferHeight);  -by Max
            // 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) {
            Rectangle2D bufferArea = new Rectangle2D.Double(0, 0, this.chartBufferWidth,
                    this.chartBufferHeight);
            Graphics2D bufferG2 = (Graphics2D) this.chartBuffer.getGraphics();
            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);
            }

            this.refreshBuffer = false;
        }

        // zap the buffer onto the panel...
        g2.drawImage(this.chartBuffer, insets.left, insets.top, this);

    }

    // or redrawing the chart every time...
    else {
        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);
    }

    // Redraw the zoom rectangle (if present)
    drawZoomRectangle(g2);

    g2.dispose();
    this.anchor = null;
    this.verticalTraceLine = null;
    this.horizontalTraceLine = null;
}

From source file:org.tsho.dmc2.core.chart.jfree.DmcChartPanel.java

/**
 * Handles a 'mouse dragged' event.//ww  w .j  a  v  a2s  .  com
 *
 * @param e  the mouse event.
 */
public void mouseDragged(MouseEvent e) {

    if (this.zoomingEnabled) {
        // if the popup menu has already been triggered, then ignore dragging...
        if (popup != null && popup.isShowing()) {
            return;
        }

        Graphics2D g2 = (Graphics2D) getGraphics();

        // use XOR to erase the previous zoom rectangle (if any)...
        g2.setXORMode(java.awt.Color.gray);
        if (zoomRectangle != null) {
            if (fillZoomRectangle) {
                g2.fill(zoomRectangle);
            } else {
                g2.draw(zoomRectangle);
            }
        }

        Rectangle2D scaledDataArea = getScaledDataArea();
        if (this.horizontalZoom && this.verticalZoom) {
            // selected rectangle shouldn't extend outside the data area...
            double xmax = Math.min(e.getX(), scaledDataArea.getMaxX());
            double ymax = Math.min(e.getY(), scaledDataArea.getMaxY());
            zoomRectangle = new Rectangle2D.Double(zoomPoint.getX(), zoomPoint.getY(), xmax - zoomPoint.getX(),
                    ymax - zoomPoint.getY());
        } else if (this.horizontalZoom) {
            double xmax = Math.min(e.getX(), scaledDataArea.getMaxX());
            zoomRectangle = new Rectangle2D.Double(zoomPoint.getX(), scaledDataArea.getMinY(),
                    xmax - zoomPoint.getX(), scaledDataArea.getHeight());
        } else if (this.verticalZoom) {
            double ymax = Math.min(e.getY(), scaledDataArea.getMaxY());
            zoomRectangle = new Rectangle2D.Double(scaledDataArea.getMinX(), zoomPoint.getY(),
                    scaledDataArea.getWidth(), ymax - zoomPoint.getY());
        }

        if (zoomRectangle != null) {
            // use XOR to draw the new zoom rectangle...
            if (fillZoomRectangle) {
                g2.fill(zoomRectangle);
            } else {
                g2.draw(zoomRectangle);
            }
        }
        g2.dispose();
    }
}

From source file:org.rdv.viz.chart.ChartPanel.java

/**
 * 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.
 *//*from w  ww .j  a  v a 2 s  .c  om*/
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) {

        // if buffer is being refreshed, it needs clearing unless it is
        // new - use the following flag to track this...
        boolean clearBuffer = true;

        // 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();
            this.chartBuffer = createImage(this.chartBufferWidth, this.chartBufferHeight);
            //                GraphicsConfiguration gc = g2.getDeviceConfiguration();
            //                this.chartBuffer = gc.createCompatibleImage(
            //                        this.chartBufferWidth, this.chartBufferHeight,
            //                        Transparency.TRANSLUCENT);
            this.refreshBuffer = true;
            clearBuffer = false; // buffer is new, no clearing required
        }

        // do we need to redraw the buffer?
        if (this.refreshBuffer) {

            this.refreshBuffer = false; // clear the flag

            Rectangle2D bufferArea = new Rectangle2D.Double(0, 0, this.chartBufferWidth,
                    this.chartBufferHeight);

            Graphics2D bufferG2 = (Graphics2D) this.chartBuffer.getGraphics();
            if (clearBuffer) {
                bufferG2.clearRect(0, 0, this.chartBufferWidth, this.chartBufferHeight);
            }
            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);

    }

    // or redrawing the chart every time...
    else {

        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);

    }

    // Redraw the zoom rectangle (if present)
    drawZoomRectangle(g2);

    g2.dispose();

    this.anchor = null;
    this.verticalTraceLine = null;
    this.horizontalTraceLine = null;

}

From source file:com.isti.traceview.common.TraceViewChartPanel.java

/**
 * Zooms in on a selected region.//from   w  ww  . j  av  a  2s.c  o m
 * 
 * @param selection
 *            the selected region.
 */
public void zoom(Rectangle2D selection) {

    // get the origin of the zoom selection in the Java2D space used for
    // drawing the chart (that is, before any scaling to fit the panel)
    Point2D selectOrigin = translateScreenToJava2D(
            new Point((int) Math.ceil(selection.getX()), (int) Math.ceil(selection.getY())));
    PlotRenderingInfo plotInfo = this.info.getPlotInfo();
    Rectangle2D scaledDataArea = getScreenDataArea((int) selection.getCenterX(), (int) selection.getCenterY());
    if ((selection.getHeight() > 0) && (selection.getWidth() > 0)) {

        double hLower = (selection.getMinX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth();
        double hUpper = (selection.getMaxX() - scaledDataArea.getMinX()) / scaledDataArea.getWidth();
        double vLower = (scaledDataArea.getMaxY() - selection.getMaxY()) / scaledDataArea.getHeight();
        double vUpper = (scaledDataArea.getMaxY() - selection.getMinY()) / scaledDataArea.getHeight();

        Plot p = this.chart.getPlot();
        if (p instanceof Zoomable) {
            Zoomable z = (Zoomable) p;
            if (z.getOrientation() == PlotOrientation.HORIZONTAL) {
                z.zoomDomainAxes(vLower, vUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(hLower, hUpper, plotInfo, selectOrigin);
            } else {
                z.zoomDomainAxes(hLower, hUpper, plotInfo, selectOrigin);
                z.zoomRangeAxes(vLower, vUpper, plotInfo, selectOrigin);
            }
        }
    }
}

From source file:org.gumtree.vis.awt.JChartPanel.java

@Override
public void draw(Graphics2D g2, Rectangle2D area, double shiftX, double shiftY) {
    //       g2.setPaint(Color.white);
    //      g2.fill(new Rectangle2D.Double(0, 0, getWidth(), getHeight()));
    //      if (getChart() != null) {
    ////         Image chartImage = getChart().createBufferedImage((int) area.getWidth(),
    ////               (int) area.getHeight());
    ////         g2.drawImage(chartImage, (int) area.getMinX(), (int) area.getMinY(), 
    ////               this);
    //         getChart().draw(g2, area, getAnchor(), null);
    //         ChartMaskingUtilities.drawMasks(g2, getScreenDataArea(), maskList, 
    //               null, getChart());
    //      }//from   w w  w .j a v  a  2s .  co m
    double widthRatio = area.getWidth() / getWidth();
    double heightRatio = area.getHeight() / getHeight();
    double overallRatio = 1;
    overallRatio = widthRatio < heightRatio ? widthRatio : heightRatio;

    XYPlot plot = (XYPlot) getChart().getPlot();
    Font domainFont = plot.getDomainAxis().getLabelFont();
    int domainSize = domainFont.getSize();
    Font rangeFont = plot.getRangeAxis().getLabelFont();
    int rangeSize = rangeFont.getSize();
    TextTitle titleBlock = getChart().getTitle();
    Font titleFont = null;
    int titleSize = 0;
    if (titleBlock != null) {
        titleFont = titleBlock.getFont();
        titleSize = titleFont.getSize();
        getChart().getTitle().setFont(titleFont.deriveFont((float) (titleSize * overallRatio)));
    }
    Font domainScaleFont = plot.getDomainAxis().getTickLabelFont();
    int domainScaleSize = domainScaleFont.getSize();
    Font rangeScaleFont = plot.getRangeAxis().getTickLabelFont();
    int rangeScaleSize = rangeScaleFont.getSize();
    plot.getDomainAxis().setLabelFont(domainFont.deriveFont((float) (domainSize * overallRatio)));
    plot.getRangeAxis().setLabelFont(rangeFont.deriveFont((float) (rangeSize * overallRatio)));
    plot.getDomainAxis().setTickLabelFont(domainScaleFont.deriveFont((float) (domainScaleSize * overallRatio)));
    plot.getRangeAxis().setTickLabelFont(rangeScaleFont.deriveFont((float) (rangeScaleSize * overallRatio)));
    LegendTitle legend = getChart().getLegend();
    Font legendFont = null;
    int legendFontSize = 0;
    if (legend != null) {
        legendFont = legend.getItemFont();
        legendFontSize = legendFont.getSize();
        legend.setItemFont(legendFont.deriveFont((float) (legendFontSize * overallRatio)));
    }

    Rectangle2D chartArea = (Rectangle2D) area.clone();
    getChart().getPadding().trim(chartArea);
    if (titleBlock != null) {
        AxisUtilities.trimTitle(chartArea, g2, titleBlock, titleBlock.getPosition());
    }

    Axis scaleAxis = null;
    Font scaleAxisFont = null;
    int scaleAxisFontSize = 0;
    for (Object object : getChart().getSubtitles()) {
        Title title = (Title) object;
        if (title instanceof PaintScaleLegend) {
            scaleAxis = ((PaintScaleLegend) title).getAxis();
            scaleAxisFont = scaleAxis.getTickLabelFont();
            scaleAxisFontSize = scaleAxisFont.getSize();
            scaleAxis.setTickLabelFont(scaleAxisFont.deriveFont((float) (scaleAxisFontSize * overallRatio)));
        }
        AxisUtilities.trimTitle(chartArea, g2, title, title.getPosition());
    }
    AxisSpace axisSpace = AxisUtilities.calculateAxisSpace(getChart().getXYPlot(), g2, chartArea);
    Rectangle2D dataArea = axisSpace.shrink(chartArea, null);
    getChart().getXYPlot().getInsets().trim(dataArea);
    getChart().getXYPlot().getAxisOffset().trim(dataArea);

    //        Rectangle2D screenArea = getScreenDataArea();
    //        Rectangle2D visibleArea = getVisibleRect();
    //        Rectangle2D printScreenArea = new Rectangle2D.Double(screenArea.getMinX() * overallRatio + x, 
    //              screenArea.getMinY() * overallRatio + y, 
    //              printArea.getWidth() - visibleArea.getWidth() + screenArea.getWidth(), 
    //              printArea.getHeight() - visibleArea.getHeight() + screenArea.getHeight());

    getChart().draw(g2, area, getAnchor(), null);
    ChartMaskingUtilities.drawMasks(g2, dataArea, maskList, null, getChart(), overallRatio);
    ChartMaskingUtilities.drawShapes(g2, dataArea, shapeMap, getChart());
    ChartMaskingUtilities.drawText(g2, dataArea, textContentMap, getChart());
    plot.getDomainAxis().setLabelFont(domainFont);
    plot.getRangeAxis().setLabelFont(rangeFont);
    if (titleBlock != null) {
        titleBlock.setFont(titleFont);
    }
    if (legend != null) {
        legend.setItemFont(legendFont);
    }
    plot.getDomainAxis().setTickLabelFont(domainScaleFont);
    plot.getRangeAxis().setTickLabelFont(rangeScaleFont);
    if (scaleAxis != null) {
        scaleAxis.setTickLabelFont(scaleAxisFont);
    }
    //        System.out.println("print " + titleBlock.getText() + 
    //              " at [" + area.getX() + ", " + area.getY() + ", " + 
    //              area.getWidth() + ", " + area.getHeight() + "]");
}

From source file:edu.cuny.jfree.chart.renderer.category.IntervalListBarRenderer.java

/**
 * Draws a single interval./* w w  w  .  j a  va 2  s  . c o m*/
 * 
 * @param g2
 *          the graphics device.
 * @param state
 *          the renderer state.
 * @param dataArea
 *          the data plot area.
 * @param plot
 *          the plot.
 * @param domainAxis
 *          the domain axis.
 * @param rangeAxis
 *          the range axis.
 * @param dataset
 *          the data.
 * @param row
 *          the row index (zero-based).
 * @param column
 *          the column index (zero-based).
 */
protected void drawInterval(final Graphics2D g2, final CategoryItemRendererState state,
        final Rectangle2D dataArea, final CategoryPlot plot, final CategoryAxis domainAxis,
        final ValueAxis rangeAxis, final DefaultIntervalListCategoryDataset dataset, final int row,
        final int column) {

    final int seriesCount = getRowCount();
    final int categoryCount = getColumnCount();

    final PlotOrientation orientation = plot.getOrientation();

    double rectX = 0.0;
    double rectY = 0.0;

    final RectangleEdge domainAxisLocation = plot.getDomainAxisEdge();
    final RectangleEdge rangeAxisLocation = plot.getRangeAxisEdge();

    final List list = dataset.getList(row, column);

    if (list == null) {
        return;
    }

    Interval interval = null;
    for (int i = 0; i < list.size(); i++) {

        interval = (Interval) list.get(i);

        if (!interval.isMeaningful()) {
            continue;
        }

        // Y0
        double java2dValue0 = rangeAxis.valueToJava2D(interval.low, dataArea, rangeAxisLocation);

        // Y1
        double java2dValue1 = rangeAxis.valueToJava2D(interval.high, dataArea, rangeAxisLocation);

        if (java2dValue1 < java2dValue0) {
            final double temp = java2dValue1;
            java2dValue1 = java2dValue0;
            java2dValue0 = temp;
        }

        // BAR WIDTH
        double rectWidth = state.getBarWidth();

        // BAR HEIGHT
        double rectHeight = Math.abs(java2dValue1 - java2dValue0);

        if (orientation == PlotOrientation.HORIZONTAL) {
            // BAR Y
            rectY = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, domainAxisLocation);
            if (seriesCount > 1) {
                final double seriesGap = dataArea.getHeight() * getItemMargin()
                        / (categoryCount * (seriesCount - 1));
                rectY = rectY + row * (state.getBarWidth() + seriesGap);
            } else {
                rectY = rectY + row * state.getBarWidth();
            }

            rectX = java2dValue0;

            rectHeight = state.getBarWidth();
            rectWidth = Math.abs(java2dValue1 - java2dValue0);

        } else if (orientation == PlotOrientation.VERTICAL) {
            // BAR X
            rectX = domainAxis.getCategoryStart(column, getColumnCount(), dataArea, domainAxisLocation);

            if (seriesCount > 1) {
                final double seriesGap = dataArea.getWidth() * getItemMargin()
                        / (categoryCount * (seriesCount - 1));
                rectX = rectX + row * (state.getBarWidth() + seriesGap);
            } else {
                rectX = rectX + row * state.getBarWidth();
            }

            rectY = java2dValue0;

        }
        final Rectangle2D bar = new Rectangle2D.Double(rectX, rectY, rectWidth, rectHeight);
        final Paint seriesPaint = getItemPaint(row, column);
        g2.setPaint(seriesPaint);
        g2.fill(bar);

        // draw the outline...
        if (state.getBarWidth() > BarRenderer.BAR_OUTLINE_WIDTH_THRESHOLD) {
            final Stroke stroke = getItemOutlineStroke(row, column);
            final Paint paint = getItemOutlinePaint(row, column);
            if ((stroke != null) && (paint != null)) {
                g2.setStroke(stroke);
                g2.setPaint(paint);
                g2.draw(bar);
            }
        }

        final CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column);
        if ((generator != null) && isItemLabelVisible(row, column)) {
            drawItemLabel(g2, dataset, row, column, plot, generator, bar, false);
        }

        // collect entity and tool tip information...
        if (state.getInfo() != null) {
            final EntityCollection entities = state.getInfo().getOwner().getEntityCollection();
            if (entities != null) {
                String tip = null;
                final CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
                if (tipster != null) {
                    tip = tipster.generateToolTip(dataset, row, column);
                }
                String url = null;
                if (getItemURLGenerator(row, column) != null) {
                    url = getItemURLGenerator(row, column).generateURL(dataset, row, column);
                }
                final CategoryItemEntity entity = new CategoryItemEntity(bar, tip, url, dataset,
                        dataset.getRowKey(row), dataset.getColumnKey(column));
                entities.add(entity);
            }
        }
    }
}