Search in sources :

Example 6 with GradientPaintTransformer

use of org.jfree.chart.util.GradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class StandardXYBarPainter method paintBar.

/**
 * Paints a single bar instance.
 *
 * @param g2  the graphics target.
 * @param renderer  the renderer.
 * @param row  the row index.
 * @param column  the column index.
 * @param bar  the bar
 * @param base  indicates which side of the rectangle is the base of the
 *              bar.
 */
@Override
public void paintBar(Graphics2D g2, XYBarRenderer renderer, int row, int column, RectangularShape bar, RectangleEdge base) {
    Paint itemPaint = renderer.getItemPaint(row, column);
    GradientPaintTransformer t = renderer.getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);
    // draw the outline...
    if (renderer.isDrawBarOutline()) {
        // && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = renderer.getItemOutlineStroke(row, column);
        Paint paint = renderer.getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }
}
Also used : Stroke(java.awt.Stroke) GradientPaintTransformer(org.jfree.chart.util.GradientPaintTransformer) GradientPaint(java.awt.GradientPaint) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint)

Example 7 with GradientPaintTransformer

use of org.jfree.chart.util.GradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class AbstractCategoryItemRenderer method drawRangeMarker.

/**
 * Draws a marker for the range axis.
 *
 * @param g2  the graphics device (not {@code null}).
 * @param plot  the plot (not {@code null}).
 * @param axis  the range axis (not {@code null}).
 * @param marker  the marker to be drawn (not {@code null}).
 * @param dataArea  the area inside the axes (not {@code null}).
 *
 * @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);
            Point2D coords = calculateRangeMarkerTextAnchorPoint(g2, orientation, dataArea, rect, marker.getLabelOffset(), marker.getLabelOffsetType(), anchor);
            Rectangle2D r = TextUtils.calcAlignedStringBounds(label, g2, (float) coords.getX(), (float) coords.getY(), marker.getLabelTextAnchor());
            g2.setPaint(marker.getLabelBackgroundColor());
            g2.fill(r);
            g2.setPaint(marker.getLabelPaint());
            TextUtils.drawAlignedString(label, g2, (float) coords.getX(), (float) coords.getY(), marker.getLabelTextAnchor());
        }
        g2.setComposite(savedComposite);
    }
}
Also used : PlotOrientation(org.jfree.chart.plot.PlotOrientation) GradientPaintTransformer(org.jfree.chart.util.GradientPaintTransformer) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) Rectangle2D(java.awt.geom.Rectangle2D) GradientPaint(java.awt.GradientPaint) RectangleAnchor(org.jfree.chart.api.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 8 with GradientPaintTransformer

use of org.jfree.chart.util.GradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class StatisticalBarRenderer method drawVerticalItem.

/**
 * Draws an item for a plot with a vertical orientation.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the data.
 * @param visibleRow  the visible row index.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 */
protected void drawVerticalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, StatisticalCategoryDataset dataset, int visibleRow, int row, int column) {
    // BAR X
    double rectX = calculateBarW0(plot, PlotOrientation.VERTICAL, dataArea, domainAxis, state, visibleRow, column);
    // BAR Y
    Number meanValue = dataset.getMeanValue(row, column);
    if (meanValue == null) {
        return;
    }
    double value = meanValue.doubleValue();
    double base = 0.0;
    double lclip = getLowerClip();
    double uclip = getUpperClip();
    if (uclip <= 0.0) {
        // cases 1, 2, 3 and 4
        if (value >= uclip) {
            // bar is not visible
            return;
        }
        base = uclip;
        if (value <= lclip) {
            value = lclip;
        }
    } else if (lclip <= 0.0) {
        // cases 5, 6, 7 and 8
        if (value >= uclip) {
            value = uclip;
        } else {
            if (value <= lclip) {
                value = lclip;
            }
        }
    } else {
        // cases 9, 10, 11 and 12
        if (value <= lclip) {
            // bar is not visible
            return;
        }
        base = getLowerClip();
        if (value >= uclip) {
            value = uclip;
        }
    }
    RectangleEdge yAxisLocation = plot.getRangeAxisEdge();
    double transY1 = rangeAxis.valueToJava2D(base, dataArea, yAxisLocation);
    double transY2 = rangeAxis.valueToJava2D(value, dataArea, yAxisLocation);
    double rectY = Math.min(transY2, transY1);
    double rectWidth = state.getBarWidth();
    double rectHeight = Math.abs(transY2 - transY1);
    Rectangle2D bar = new Rectangle2D.Double(rectX, rectY, rectWidth, rectHeight);
    Paint itemPaint = getItemPaint(row, column);
    GradientPaintTransformer t = getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);
    // draw the outline...
    if (isDrawBarOutline() && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = getItemOutlineStroke(row, column);
        Paint paint = getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }
    // standard deviation lines
    Number n = dataset.getStdDevValue(row, column);
    if (n != null) {
        double valueDelta = n.doubleValue();
        double highVal = rangeAxis.valueToJava2D(meanValue.doubleValue() + valueDelta, dataArea, yAxisLocation);
        double lowVal = rangeAxis.valueToJava2D(meanValue.doubleValue() - valueDelta, dataArea, yAxisLocation);
        if (this.errorIndicatorPaint != null) {
            g2.setPaint(this.errorIndicatorPaint);
        } else {
            g2.setPaint(getItemOutlinePaint(row, column));
        }
        if (this.errorIndicatorStroke != null) {
            g2.setStroke(this.errorIndicatorStroke);
        } else {
            g2.setStroke(getItemOutlineStroke(row, column));
        }
        Line2D line;
        line = new Line2D.Double(rectX + rectWidth / 2.0d, lowVal, rectX + rectWidth / 2.0d, highVal);
        g2.draw(line);
        line = new Line2D.Double(rectX + rectWidth / 2.0d - 5.0d, highVal, rectX + rectWidth / 2.0d + 5.0d, highVal);
        g2.draw(line);
        line = new Line2D.Double(rectX + rectWidth / 2.0d - 5.0d, lowVal, rectX + rectWidth / 2.0d + 5.0d, lowVal);
        g2.draw(line);
    }
    CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column);
    if (generator != null && isItemLabelVisible(row, column)) {
        drawItemLabel(g2, dataset, row, column, plot, generator, bar, (value < 0.0));
    }
    // add an item entity, if this information is being collected
    EntityCollection entities = state.getEntityCollection();
    if (entities != null) {
        addItemEntity(entities, dataset, row, column, bar);
    }
}
Also used : Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) GradientPaintTransformer(org.jfree.chart.util.GradientPaintTransformer) Rectangle2D(java.awt.geom.Rectangle2D) GradientPaint(java.awt.GradientPaint) CategoryItemLabelGenerator(org.jfree.chart.labels.CategoryItemLabelGenerator) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint) Line2D(java.awt.geom.Line2D) EntityCollection(org.jfree.chart.entity.EntityCollection) RectangleEdge(org.jfree.chart.api.RectangleEdge)

Example 9 with GradientPaintTransformer

use of org.jfree.chart.util.GradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class AbstractXYItemRenderer method drawRangeMarker.

/**
 * Draws a line on the chart perpendicular to the y-axis to mark a value
 * or range of values.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param rangeAxis  the range axis.
 * @param marker  the marker line.
 * @param dataArea  the axis data area.
 */
@Override
public void drawRangeMarker(Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, Rectangle2D dataArea) {
    if (marker instanceof ValueMarker) {
        ValueMarker vm = (ValueMarker) marker;
        double value = vm.getValue();
        Range range = rangeAxis.getRange();
        if (!range.contains(value)) {
            return;
        }
        double v = rangeAxis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());
        PlotOrientation orientation = plot.getOrientation();
        Line2D line = null;
        switch(orientation) {
            case HORIZONTAL:
                line = new Line2D.Double(v, dataArea.getMinY(), v, dataArea.getMaxY());
                break;
            case VERTICAL:
                line = new Line2D.Double(dataArea.getMinX(), v, dataArea.getMaxX(), v);
                break;
            default:
                throw new IllegalStateException("Unrecognised orientation.");
        }
        final Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, marker.getAlpha()));
        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 coords = calculateRangeMarkerTextAnchorPoint(g2, orientation, dataArea, line.getBounds2D(), marker.getLabelOffset(), LengthAdjustmentType.EXPAND, anchor);
            Rectangle2D r = TextUtils.calcAlignedStringBounds(label, g2, (float) coords.getX(), (float) coords.getY(), marker.getLabelTextAnchor());
            g2.setPaint(marker.getLabelBackgroundColor());
            g2.fill(r);
            g2.setPaint(marker.getLabelPaint());
            TextUtils.drawAlignedString(label, g2, (float) coords.getX(), (float) coords.getY(), marker.getLabelTextAnchor());
        }
        g2.setComposite(originalComposite);
    } else if (marker instanceof IntervalMarker) {
        IntervalMarker im = (IntervalMarker) marker;
        double start = im.getStartValue();
        double end = im.getEndValue();
        Range range = rangeAxis.getRange();
        if (!(range.intersects(start, end))) {
            return;
        }
        double start2d = rangeAxis.valueToJava2D(start, dataArea, plot.getRangeAxisEdge());
        double end2d = rangeAxis.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);
        }
        final Composite originalComposite = g2.getComposite();
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, marker.getAlpha()));
        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);
            Point2D coords = calculateRangeMarkerTextAnchorPoint(g2, orientation, dataArea, rect, marker.getLabelOffset(), marker.getLabelOffsetType(), anchor);
            Rectangle2D r = TextUtils.calcAlignedStringBounds(label, g2, (float) coords.getX(), (float) coords.getY(), marker.getLabelTextAnchor());
            g2.setPaint(marker.getLabelBackgroundColor());
            g2.fill(r);
            g2.setPaint(marker.getLabelPaint());
            TextUtils.drawAlignedString(label, g2, (float) coords.getX(), (float) coords.getY(), marker.getLabelTextAnchor());
        }
        g2.setComposite(originalComposite);
    }
}
Also used : PlotOrientation(org.jfree.chart.plot.PlotOrientation) GradientPaintTransformer(org.jfree.chart.util.GradientPaintTransformer) Composite(java.awt.Composite) AlphaComposite(java.awt.AlphaComposite) Rectangle2D(java.awt.geom.Rectangle2D) GradientPaint(java.awt.GradientPaint) RectangleAnchor(org.jfree.chart.api.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 10 with GradientPaintTransformer

use of org.jfree.chart.util.GradientPaintTransformer in project ES-LEI-2Sem-2022-Grupo-1 by tmrbo-iscte.

the class LayeredBarRenderer method drawHorizontalItem.

/**
 * Draws the bar for a single (series, category) data item.
 *
 * @param g2  the graphics device.
 * @param state  the renderer state.
 * @param dataArea  the data area.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 * @param dataset  the dataset.
 * @param row  the row index (zero-based).
 * @param column  the column index (zero-based).
 */
protected void drawHorizontalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column) {
    // nothing is drawn for null values...
    Number dataValue = dataset.getValue(row, column);
    if (dataValue == null) {
        return;
    }
    // X
    double value = dataValue.doubleValue();
    double base = getBase();
    double lclip = getLowerClip();
    double uclip = getUpperClip();
    if (uclip <= 0.0) {
        // cases 1, 2, 3 and 4
        if (value >= uclip) {
            // bar is not visible
            return;
        }
        base = uclip;
        if (value <= lclip) {
            value = lclip;
        }
    } else if (lclip <= 0.0) {
        // cases 5, 6, 7 and 8
        if (value >= uclip) {
            value = uclip;
        } else {
            if (value <= lclip) {
                value = lclip;
            }
        }
    } else {
        // cases 9, 10, 11 and 12
        if (value <= lclip) {
            // bar is not visible
            return;
        }
        base = lclip;
        if (value >= uclip) {
            value = uclip;
        }
    }
    RectangleEdge edge = plot.getRangeAxisEdge();
    double transX1 = rangeAxis.valueToJava2D(base, dataArea, edge);
    double transX2 = rangeAxis.valueToJava2D(value, dataArea, edge);
    double rectX = Math.min(transX1, transX2);
    double rectWidth = Math.abs(transX2 - transX1);
    // Y
    double rectY = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0;
    int seriesCount = getRowCount();
    // draw the bar...
    double shift = 0.0;
    double rectHeight;
    double widthFactor = 1.0;
    double seriesBarWidth = getSeriesBarWidth(row);
    if (!Double.isNaN(seriesBarWidth)) {
        widthFactor = seriesBarWidth;
    }
    rectHeight = widthFactor * state.getBarWidth();
    rectY = rectY + (1 - widthFactor) * state.getBarWidth() / 2.0;
    if (seriesCount > 1) {
        shift = rectHeight * 0.20 / (seriesCount - 1);
    }
    Rectangle2D bar = new Rectangle2D.Double(rectX, (rectY + ((seriesCount - 1 - row) * shift)), rectWidth, (rectHeight - (seriesCount - 1 - row) * shift * 2));
    if (state.getElementHinting()) {
        beginElementGroup(g2, dataset.getRowKey(row), dataset.getColumnKey(column));
    }
    Paint itemPaint = getItemPaint(row, column);
    GradientPaintTransformer t = getGradientPaintTransformer();
    if (t != null && itemPaint instanceof GradientPaint) {
        itemPaint = t.transform((GradientPaint) itemPaint, bar);
    }
    g2.setPaint(itemPaint);
    g2.fill(bar);
    // draw the outline...
    if (isDrawBarOutline() && state.getBarWidth() > BAR_OUTLINE_WIDTH_THRESHOLD) {
        Stroke stroke = getItemOutlineStroke(row, column);
        Paint paint = getItemOutlinePaint(row, column);
        if (stroke != null && paint != null) {
            g2.setStroke(stroke);
            g2.setPaint(paint);
            g2.draw(bar);
        }
    }
    CategoryItemLabelGenerator generator = getItemLabelGenerator(row, column);
    if (generator != null && isItemLabelVisible(row, column)) {
        drawItemLabel(g2, dataset, row, column, plot, generator, bar, value < base);
    }
    // collect entity and tool tip information...
    EntityCollection entities = state.getEntityCollection();
    if (entities != null) {
        addItemEntity(entities, dataset, row, column, bar);
    }
}
Also used : Stroke(java.awt.Stroke) GradientPaintTransformer(org.jfree.chart.util.GradientPaintTransformer) EntityCollection(org.jfree.chart.entity.EntityCollection) Rectangle2D(java.awt.geom.Rectangle2D) GradientPaint(java.awt.GradientPaint) CategoryItemLabelGenerator(org.jfree.chart.labels.CategoryItemLabelGenerator) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint) Paint(java.awt.Paint) GradientPaint(java.awt.GradientPaint) RectangleEdge(org.jfree.chart.api.RectangleEdge)

Aggregations

GradientPaintTransformer (org.jfree.chart.util.GradientPaintTransformer)10 GradientPaint (java.awt.GradientPaint)9 Paint (java.awt.Paint)9 Rectangle2D (java.awt.geom.Rectangle2D)7 Stroke (java.awt.Stroke)5 Line2D (java.awt.geom.Line2D)5 RectangleEdge (org.jfree.chart.api.RectangleEdge)4 EntityCollection (org.jfree.chart.entity.EntityCollection)4 CategoryItemLabelGenerator (org.jfree.chart.labels.CategoryItemLabelGenerator)4 AlphaComposite (java.awt.AlphaComposite)3 Composite (java.awt.Composite)3 Font (java.awt.Font)3 Point2D (java.awt.geom.Point2D)3 RectangleAnchor (org.jfree.chart.api.RectangleAnchor)3 IntervalMarker (org.jfree.chart.plot.IntervalMarker)3 PlotOrientation (org.jfree.chart.plot.PlotOrientation)3 ValueMarker (org.jfree.chart.plot.ValueMarker)3 Range (org.jfree.data.Range)3 BasicStroke (java.awt.BasicStroke)2 StandardGradientPaintTransformer (org.jfree.chart.util.StandardGradientPaintTransformer)1