Example usage for org.jfree.chart.renderer.category BarRenderer isDrawBarOutline

List of usage examples for org.jfree.chart.renderer.category BarRenderer isDrawBarOutline

Introduction

In this page you can find the example usage for org.jfree.chart.renderer.category BarRenderer isDrawBarOutline.

Prototype

public boolean isDrawBarOutline() 

Source Link

Document

Returns a flag that controls whether or not bar outlines are drawn.

Usage

From source file:edu.jhuapl.graphs.jfreechart.CategoryGraphBarPainter.java

@Override
public void paintBar(Graphics2D g2, BarRenderer renderer, int row, int column, RectangularShape bar,
        RectangleEdge base) {//from w  w w  .  j  a v a 2s  .c om
    Paint itemPaint = itemProperty.get(row, column, Paint.class, renderer.getItemPaint(row, column),
            GraphSource.ITEM_COLOR);
    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()) {
        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);
        }
    }
}

From source file:com.rapidminer.gui.plotter.charts.RapidBarPainter.java

/**
 * Paints a single bar instance.// w w w .j  ava2 s.  co  m
 * 
 * @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(final Graphics2D g2, final BarRenderer renderer, final int row, final int column,
        final RectangularShape bar, final RectangleEdge base) {
    Paint itemPaint = renderer.getItemPaint(row, column);

    Color c0 = null;

    if (itemPaint instanceof Color) {
        c0 = (Color) itemPaint;
    } else {
        c0 = SwingTools.DARK_BLUE;
    }

    // as a special case, if the bar color has alpha == 0, we draw
    // nothing.
    if (c0.getAlpha() == 0) {
        return;
    }

    g2.setPaint(c0);
    g2.fill(new Rectangle2D.Double(bar.getMinX(), bar.getMinY(), bar.getWidth(), bar.getHeight()));

    // draw the outline...
    if (renderer.isDrawBarOutline()) {
        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);
        }
    }

}