Java Code Examples for org.jfree.chart.renderer.category.BarRenderer#setShadowPaint()

The following examples show how to use org.jfree.chart.renderer.category.BarRenderer#setShadowPaint() . 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: ChartWriterFactory.java    From entity-system-benchmarks with Apache License 2.0 5 votes vote down vote up
private static void notSoUglyPlease(JFreeChart chart) {
	String fontName = "Lucida Sans";

	StandardChartTheme theme = (StandardChartTheme)org.jfree.chart.StandardChartTheme.createJFreeTheme();

	theme.setTitlePaint( Color.decode("#4572a7") );
	theme.setExtraLargeFont(new Font(fontName, Font.BOLD, 14)); //title
	theme.setLargeFont(new Font(fontName, Font.BOLD, 15)); //axis-title
	theme.setRegularFont(new Font(fontName, Font.PLAIN, 11));
	theme.setRangeGridlinePaint(Color.decode("#C0C0C0"));
	theme.setPlotBackgroundPaint(Color.white);
	theme.setChartBackgroundPaint(Color.white);
	theme.setGridBandPaint(Color.red);
	theme.setAxisOffset(new RectangleInsets(0, 0, 0, 0));
	theme.setBarPainter(new StandardBarPainter());
	theme.setAxisLabelPaint(Color.decode("#666666"));
	theme.apply(chart);
	chart.getCategoryPlot().setOutlineVisible(false);
	chart.getCategoryPlot().getRangeAxis().setAxisLineVisible(false);
	chart.getCategoryPlot().getRangeAxis().setTickMarksVisible(false);
	chart.getCategoryPlot().setRangeGridlineStroke(new BasicStroke());
	chart.getCategoryPlot().getRangeAxis().setTickLabelPaint(Color.decode("#666666"));
	chart.getCategoryPlot().getDomainAxis().setTickLabelPaint(Color.decode("#666666"));
	chart.setTextAntiAlias(true);
	chart.setAntiAlias(true);
	BarRenderer rend = (BarRenderer) chart.getCategoryPlot().getRenderer();
	rend.setShadowVisible(true);
	rend.setShadowXOffset(2);
	rend.setShadowYOffset(0);
	rend.setShadowPaint(Color.decode("#C0C0C0"));
	rend.setMaximumBarWidth(0.1);
}
 
Example 2
Source File: BarChartExpression.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected void configureChart( final JFreeChart chart ) {
  final CategoryPlot cpl = chart.getCategoryPlot();
  final CategoryItemRenderer renderer = cpl.getRenderer();
  final BarRenderer br = (BarRenderer) renderer;
  if ( isAutoRange() ) {
    br.setIncludeBaseInRange( false );
  }
  super.configureChart( chart );
  br.setDrawBarOutline( isChartSectionOutline() );
  if ( maxBarWidth != null ) {
    br.setMaximumBarWidth( maxBarWidth.doubleValue() );
  }

  if ( itemMargin != null ) {
    br.setItemMargin( itemMargin.doubleValue() );
  }

  if ( ( isStacked() ) && stackedBarRenderPercentages && ( br instanceof StackedBarRenderer ) ) {
    final StackedBarRenderer sbr = (StackedBarRenderer) br;
    sbr.setRenderAsPercentages( true );
  }

  br.setShadowVisible( shadowVisible );
  if ( shadowColor != null ) {
    br.setShadowPaint( shadowColor );
  }
  br.setShadowXOffset( shadowXOffset );
  br.setShadowYOffset( shadowYOffset );
}
 
Example 3
Source File: StandardChartTheme.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
    ParamChecks.nullNotPermitted(renderer, "renderer");

    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }

    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);

    // now we handle some special cases - yes, UGLY code alert!

    // BarRenderer
    if (renderer instanceof BarRenderer) {
        BarRenderer br = (BarRenderer) renderer;
        br.setBarPainter(this.barPainter);
        br.setShadowVisible(this.shadowVisible);
        br.setShadowPaint(this.shadowPaint);
    }

    // BarRenderer3D
    if (renderer instanceof BarRenderer3D) {
        BarRenderer3D br3d = (BarRenderer3D) renderer;
        br3d.setWallPaint(this.wallPaint);
    }

    // LineRenderer3D
    if (renderer instanceof LineRenderer3D) {
        LineRenderer3D lr3d = (LineRenderer3D) renderer;
        lr3d.setWallPaint(this.wallPaint);
    }

    //  StatisticalBarRenderer
    if (renderer instanceof StatisticalBarRenderer) {
        StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
        sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
    }

    // MinMaxCategoryRenderer
    if (renderer instanceof MinMaxCategoryRenderer) {
        MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
        mmcr.setGroupPaint(this.errorIndicatorPaint);
    }
}
 
Example 4
Source File: StandardChartTheme.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
    ParamChecks.nullNotPermitted(renderer, "renderer");

    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }

    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);

    // now we handle some special cases - yes, UGLY code alert!

    // BarRenderer
    if (renderer instanceof BarRenderer) {
        BarRenderer br = (BarRenderer) renderer;
        br.setBarPainter(this.barPainter);
        br.setShadowVisible(this.shadowVisible);
        br.setShadowPaint(this.shadowPaint);
    }

    // BarRenderer3D
    if (renderer instanceof BarRenderer3D) {
        BarRenderer3D br3d = (BarRenderer3D) renderer;
        br3d.setWallPaint(this.wallPaint);
    }

    // LineRenderer3D
    if (renderer instanceof LineRenderer3D) {
        LineRenderer3D lr3d = (LineRenderer3D) renderer;
        lr3d.setWallPaint(this.wallPaint);
    }

    //  StatisticalBarRenderer
    if (renderer instanceof StatisticalBarRenderer) {
        StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
        sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
    }

    // MinMaxCategoryRenderer
    if (renderer instanceof MinMaxCategoryRenderer) {
        MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
        mmcr.setGroupPaint(this.errorIndicatorPaint);
    }
}
 
Example 5
Source File: StandardChartTheme.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
    ParamChecks.nullNotPermitted(renderer, "renderer");

    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }

    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);

    // now we handle some special cases - yes, UGLY code alert!

    // BarRenderer
    if (renderer instanceof BarRenderer) {
        BarRenderer br = (BarRenderer) renderer;
        br.setBarPainter(this.barPainter);
        br.setShadowVisible(this.shadowVisible);
        br.setShadowPaint(this.shadowPaint);
    }

    // BarRenderer3D
    if (renderer instanceof BarRenderer3D) {
        BarRenderer3D br3d = (BarRenderer3D) renderer;
        br3d.setWallPaint(this.wallPaint);
    }

    // LineRenderer3D
    if (renderer instanceof LineRenderer3D) {
        LineRenderer3D lr3d = (LineRenderer3D) renderer;
        lr3d.setWallPaint(this.wallPaint);
    }

    //  StatisticalBarRenderer
    if (renderer instanceof StatisticalBarRenderer) {
        StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
        sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
    }

    // MinMaxCategoryRenderer
    if (renderer instanceof MinMaxCategoryRenderer) {
        MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
        mmcr.setGroupPaint(this.errorIndicatorPaint);
    }
}
 
Example 6
Source File: StandardChartTheme.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
    ParamChecks.nullNotPermitted(renderer, "renderer");

    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }

    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);

    // now we handle some special cases - yes, UGLY code alert!

    // BarRenderer
    if (renderer instanceof BarRenderer) {
        BarRenderer br = (BarRenderer) renderer;
        br.setBarPainter(this.barPainter);
        br.setShadowVisible(this.shadowVisible);
        br.setShadowPaint(this.shadowPaint);
    }

    // BarRenderer3D
    if (renderer instanceof BarRenderer3D) {
        BarRenderer3D br3d = (BarRenderer3D) renderer;
        br3d.setWallPaint(this.wallPaint);
    }

    // LineRenderer3D
    if (renderer instanceof LineRenderer3D) {
        LineRenderer3D lr3d = (LineRenderer3D) renderer;
        lr3d.setWallPaint(this.wallPaint);
    }

    //  StatisticalBarRenderer
    if (renderer instanceof StatisticalBarRenderer) {
        StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
        sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
    }

    // MinMaxCategoryRenderer
    if (renderer instanceof MinMaxCategoryRenderer) {
        MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
        mmcr.setGroupPaint(this.errorIndicatorPaint);
    }
}
 
Example 7
Source File: BarRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Test that the equals() method distinguishes all fields.
 */
public void testEquals() {
    BarRenderer r1 = new BarRenderer();
    BarRenderer r2 = new BarRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));

    // base value
    r1.setBase(0.123);
    assertFalse(r1.equals(r2));
    r2.setBase(0.123);
    assertTrue(r1.equals(r2));

    // itemMargin
    r1.setItemMargin(0.22);
    assertFalse(r1.equals(r2));
    r2.setItemMargin(0.22);
    assertTrue(r1.equals(r2));

    // drawBarOutline
    r1.setDrawBarOutline(!r1.isDrawBarOutline());
    assertFalse(r1.equals(r2));
    r2.setDrawBarOutline(!r2.isDrawBarOutline());
    assertTrue(r1.equals(r2));

    // maximumBarWidth
    r1.setMaximumBarWidth(0.11);
    assertFalse(r1.equals(r2));
    r2.setMaximumBarWidth(0.11);
    assertTrue(r1.equals(r2));

    // minimumBarLength
    r1.setMinimumBarLength(0.04);
    assertFalse(r1.equals(r2));
    r2.setMinimumBarLength(0.04);
    assertTrue(r1.equals(r2));

    // gradientPaintTransformer
    r1.setGradientPaintTransformer(new StandardGradientPaintTransformer(
            GradientPaintTransformType.CENTER_VERTICAL));
    assertFalse(r1.equals(r2));
    r2.setGradientPaintTransformer(new StandardGradientPaintTransformer(
            GradientPaintTransformType.CENTER_VERTICAL));
    assertTrue(r1.equals(r2));

    // positiveItemLabelPositionFallback
    r1.setPositiveItemLabelPositionFallback(new ItemLabelPosition(
            ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertFalse(r1.equals(r2));
    r2.setPositiveItemLabelPositionFallback(new ItemLabelPosition(
            ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertTrue(r1.equals(r2));

    // negativeItemLabelPositionFallback
    r1.setNegativeItemLabelPositionFallback(new ItemLabelPosition(
            ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertFalse(r1.equals(r2));
    r2.setNegativeItemLabelPositionFallback(new ItemLabelPosition(
            ItemLabelAnchor.INSIDE1, TextAnchor.CENTER));
    assertTrue(r1.equals(r2));

    // barPainter
    r1.setBarPainter(new GradientBarPainter(0.1, 0.2, 0.3));
    assertFalse(r1.equals(r2));
    r2.setBarPainter(new GradientBarPainter(0.1, 0.2, 0.3));
    assertTrue(r1.equals(r2));

    // shadowsVisible
    r1.setShadowVisible(false);
    assertFalse(r1.equals(r2));
    r2.setShadowVisible(false);
    assertTrue(r1.equals(r2));

    r1.setShadowPaint(Color.red);
    assertFalse(r1.equals(r2));
    r2.setShadowPaint(Color.red);
    assertTrue(r1.equals(r2));

    // shadowXOffset
    r1.setShadowXOffset(3.3);
    assertFalse(r1.equals(r2));
    r2.setShadowXOffset(3.3);
    assertTrue(r1.equals(r2));

    // shadowYOffset
    r1.setShadowYOffset(3.3);
    assertFalse(r1.equals(r2));
    r2.setShadowYOffset(3.3);
    assertTrue(r1.equals(r2));

}
 
Example 8
Source File: StandardChartTheme.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
    if (renderer == null) {
        throw new IllegalArgumentException("Null 'renderer' argument.");
    }

    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }

    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);

    // now we handle some special cases - yes, UGLY code alert!

    // BarRenderer
    if (renderer instanceof BarRenderer) {
        BarRenderer br = (BarRenderer) renderer;
        br.setBarPainter(this.barPainter);
        br.setShadowVisible(this.shadowVisible);
        br.setShadowPaint(this.shadowPaint);
    }

    // BarRenderer3D
    if (renderer instanceof BarRenderer3D) {
        BarRenderer3D br3d = (BarRenderer3D) renderer;
        br3d.setWallPaint(this.wallPaint);
    }

    // LineRenderer3D
    if (renderer instanceof LineRenderer3D) {
        LineRenderer3D lr3d = (LineRenderer3D) renderer;
        lr3d.setWallPaint(this.wallPaint);
    }

    //  StatisticalBarRenderer
    if (renderer instanceof StatisticalBarRenderer) {
        StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
        sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
    }

    // MinMaxCategoryRenderer
    if (renderer instanceof MinMaxCategoryRenderer) {
        MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
        mmcr.setGroupPaint(this.errorIndicatorPaint);
    }
}
 
Example 9
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
    ParamChecks.nullNotPermitted(renderer, "renderer");

    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }

    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);

    // now we handle some special cases - yes, UGLY code alert!

    // BarRenderer
    if (renderer instanceof BarRenderer) {
        BarRenderer br = (BarRenderer) renderer;
        br.setBarPainter(this.barPainter);
        br.setShadowVisible(this.shadowVisible);
        br.setShadowPaint(this.shadowPaint);
    }

    // BarRenderer3D
    if (renderer instanceof BarRenderer3D) {
        BarRenderer3D br3d = (BarRenderer3D) renderer;
        br3d.setWallPaint(this.wallPaint);
    }

    // LineRenderer3D
    if (renderer instanceof LineRenderer3D) {
        LineRenderer3D lr3d = (LineRenderer3D) renderer;
        lr3d.setWallPaint(this.wallPaint);
    }

    //  StatisticalBarRenderer
    if (renderer instanceof StatisticalBarRenderer) {
        StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
        sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
    }

    // MinMaxCategoryRenderer
    if (renderer instanceof MinMaxCategoryRenderer) {
        MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
        mmcr.setGroupPaint(this.errorIndicatorPaint);
    }
}
 
Example 10
Source File: StandardChartTheme.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Applies the settings of this theme to the specified renderer.
 *
 * @param renderer  the renderer (<code>null</code> not permitted).
 */
protected void applyToCategoryItemRenderer(CategoryItemRenderer renderer) {
    ParamChecks.nullNotPermitted(renderer, "renderer");

    if (renderer instanceof AbstractRenderer) {
        applyToAbstractRenderer((AbstractRenderer) renderer);
    }

    renderer.setBaseItemLabelFont(this.regularFont);
    renderer.setBaseItemLabelPaint(this.itemLabelPaint);

    // now we handle some special cases - yes, UGLY code alert!

    // BarRenderer
    if (renderer instanceof BarRenderer) {
        BarRenderer br = (BarRenderer) renderer;
        br.setBarPainter(this.barPainter);
        br.setShadowVisible(this.shadowVisible);
        br.setShadowPaint(this.shadowPaint);
    }

    // BarRenderer3D
    if (renderer instanceof BarRenderer3D) {
        BarRenderer3D br3d = (BarRenderer3D) renderer;
        br3d.setWallPaint(this.wallPaint);
    }

    // LineRenderer3D
    if (renderer instanceof LineRenderer3D) {
        LineRenderer3D lr3d = (LineRenderer3D) renderer;
        lr3d.setWallPaint(this.wallPaint);
    }

    //  StatisticalBarRenderer
    if (renderer instanceof StatisticalBarRenderer) {
        StatisticalBarRenderer sbr = (StatisticalBarRenderer) renderer;
        sbr.setErrorIndicatorPaint(this.errorIndicatorPaint);
    }

    // MinMaxCategoryRenderer
    if (renderer instanceof MinMaxCategoryRenderer) {
        MinMaxCategoryRenderer mmcr = (MinMaxCategoryRenderer) renderer;
        mmcr.setGroupPaint(this.errorIndicatorPaint);
    }
}