Example usage for org.jfree.chart.plot Plot setForegroundAlpha

List of usage examples for org.jfree.chart.plot Plot setForegroundAlpha

Introduction

In this page you can find the example usage for org.jfree.chart.plot Plot setForegroundAlpha.

Prototype

public void setForegroundAlpha(float alpha) 

Source Link

Document

Sets the alpha-transparency for the plot and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:org.toobsframework.pres.chart.ChartUtil.java

public static void configurePlot(IRequest componentRequest, Plot plot,
        org.toobsframework.pres.chart.config.BasePlot plotDef, DomainAxisDef categoryAxisDef,
        RangeAxisDef valueAxisDef, Map params) {
    if (plotDef != null) {
        float foregroundAlpha = Float.parseFloat(
                ParameterUtil.resolveParam(componentRequest, plotDef.getForegroundAlpha(), params, "1.0")[0]);
        plot.setForegroundAlpha(foregroundAlpha);

        if (plot instanceof CategoryPlot && ParameterUtil.resolveParam(componentRequest,
                plotDef.getOrientation(), params, "horizontal")[0].equals("horizontal")) {
            ((CategoryPlot) plot).setOrientation(PlotOrientation.HORIZONTAL);
            boolean is3D = (ParameterUtil.resolveParam(componentRequest, plotDef.getIs3D(), params, "false")[0]
                    .equals("false") ? false : true);
            if (is3D) {
                ((CategoryPlot) plot).setRowRenderingOrder(SortOrder.DESCENDING);
                ((CategoryPlot) plot).setColumnRenderingOrder(SortOrder.DESCENDING);
            }//from  w  w w. j a va2 s . c om
        } else if (plot instanceof CategoryPlot) {
            ((CategoryPlot) plot).setOrientation(PlotOrientation.VERTICAL);
        }

        if (plotDef.getInsets() != null) {
            plot.setInsets(getRectangle(componentRequest, plotDef.getInsets(), params));
        }
        if (plot instanceof CategoryPlot && plotDef.getAxisOffsets() != null) {
            ((CategoryPlot) plot)
                    .setAxisOffset(getRectangle(componentRequest, plotDef.getAxisOffsets(), params));
        }

        if (plotDef.getBackgroundColor() != null) {
            plot.setBackgroundPaint(getColor(plotDef.getBackgroundColor()));
        }
        if (plot instanceof CategoryPlot && categoryAxisDef != null) {
            AxisLocation dLabelPos = axisLocations.get(ParameterUtil.resolveParam(componentRequest,
                    categoryAxisDef.getLocation(), params, "bottomOrLeft")[0]);
            if (dLabelPos != null) {
                ((CategoryPlot) plot).setDomainAxisLocation(dLabelPos);
            }
            ((CategoryPlot) plot).setDomainGridlinesVisible(categoryAxisDef.getShowGridlines());
            if (categoryAxisDef.getGridColor() != null) {
                ((CategoryPlot) plot).setDomainGridlinePaint(getColor(categoryAxisDef.getGridColor()));
            }
        }
        if (plot instanceof CategoryPlot && valueAxisDef != null) {
            AxisLocation rLabelPos = axisLocations.get(ParameterUtil.resolveParam(componentRequest,
                    valueAxisDef.getLocation(), params, "bottomOrRight")[0]);
            if (rLabelPos != null) {
                ((CategoryPlot) plot).setRangeAxisLocation(rLabelPos);
            }
            ((CategoryPlot) plot).setRangeGridlinesVisible(valueAxisDef.getShowGridlines());
            if (valueAxisDef.getGridColor() != null) {
                ((CategoryPlot) plot).setRangeGridlinePaint(getColor(valueAxisDef.getGridColor()));
            }
        }
    }
}

From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java

public static void customizePlot(Plot plot, ChartParams params) {
    if (params.get(ChartParams.PLOT_BACKGROUND_COLOR) != null) {
        plot.setBackgroundPaint(params.getColor(ChartParams.PLOT_BACKGROUND_COLOR));
    }//from w  ww  . j a  v a 2  s  . co  m

    if (params.get(ChartParams.PLOT_BACKGROUND_ALPHA) != null) {
        plot.setBackgroundAlpha(params.getFloat(ChartParams.PLOT_BACKGROUND_ALPHA).floatValue());
    }

    if (params.get(ChartParams.PLOT_FOREGROUND_ALPHA) != null) {
        plot.setForegroundAlpha(params.getFloat(ChartParams.PLOT_FOREGROUND_ALPHA).floatValue());
    }

    if (params.get(ChartParams.PLOT_INSERTS) != null) {
        plot.setInsets(params.getRectangleInsets(ChartParams.PLOT_INSERTS));
    }

    if (params.get(ChartParams.PLOT_OUTLINE_COLOR) != null) {
        plot.setOutlinePaint(params.getColor(ChartParams.PLOT_OUTLINE_COLOR));
    }

    if (params.get(ChartParams.PLOT_OUTLINE_STROKE) != null) {
        plot.setOutlineStroke(params.getStroke(ChartParams.PLOT_OUTLINE_STROKE));
    }
}

From source file:com.igalia.java.zk.components.JFreeChartEngine.java

public byte[] drawChart(Object data) {
    Chart chart = (Chart) data;/*from  w  w  w .j a v  a  2 s  .c  om*/
    ChartImpl impl = getChartImpl(chart);
    JFreeChart jfchart = impl.createChart(chart);

    Plot plot = (Plot) jfchart.getPlot();
    float alpha = (float) (((float) chart.getFgAlpha()) / 255);
    plot.setForegroundAlpha(alpha);

    alpha = (float) (((float) chart.getBgAlpha()) / 255);
    plot.setBackgroundAlpha(alpha);

    int[] bgRGB = chart.getBgRGB();
    if (bgRGB != null) {
        plot.setBackgroundPaint(new Color(bgRGB[0], bgRGB[1], bgRGB[2], chart.getBgAlpha()));
    }

    int[] paneRGB = chart.getPaneRGB();
    if (paneRGB != null) {
        jfchart.setBackgroundPaint(new Color(paneRGB[0], paneRGB[1], paneRGB[2], chart.getPaneAlpha()));
    }

    //since 3.6.3, JFreeChart 1.0.13 change default fonts which does not support Chinese, allow
    //developer to set font.

    //title font
    final Font tfont = chart.getTitleFont();
    if (tfont != null) {
        jfchart.getTitle().setFont(tfont);
    }

    //legend font
    final Font lfont = chart.getLegendFont();
    if (lfont != null) {
        jfchart.getLegend().setItemFont(lfont);
    }

    if (plot instanceof CategoryPlot) {
        final CategoryPlot cplot = (CategoryPlot) plot;
        cplot.setRangeGridlinePaint(new Color(0xc0, 0xc0, 0xc0));

        //Domain axis(x axis)
        final Font xlbfont = chart.getXAxisFont();
        final Font xtkfont = chart.getXAxisTickFont();
        if (xlbfont != null) {
            cplot.getDomainAxis().setLabelFont(xlbfont);
        }
        if (xtkfont != null) {
            cplot.getDomainAxis().setTickLabelFont(xtkfont);
        }

        Color[] colorMappings = (Color[]) chart.getAttribute("series-color-mappings");
        if (colorMappings != null) {
            for (int ii = 0; ii < colorMappings.length; ii++) {
                cplot.getRenderer().setSeriesPaint(ii, colorMappings[ii]);
            }
        }

        Double lowerBound = (Double) chart.getAttribute("range-axis-lower-bound");
        if (lowerBound != null) {
            cplot.getRangeAxis().setAutoRange(false);
            cplot.getRangeAxis().setLowerBound(lowerBound);
        }

        Double upperBound = (Double) chart.getAttribute("range-axis-upper-bound");
        if (upperBound != null) {
            cplot.getRangeAxis().setAutoRange(false);
            cplot.getRangeAxis().setUpperBound(upperBound);
        }

        //Range axis(y axis)
        final Font ylbfont = chart.getYAxisFont();
        final Font ytkfont = chart.getYAxisTickFont();
        if (ylbfont != null) {
            cplot.getRangeAxis().setLabelFont(ylbfont);
        }
        if (ytkfont != null) {
            cplot.getRangeAxis().setTickLabelFont(ytkfont);
        }
    } else if (plot instanceof XYPlot) {
        final XYPlot xyplot = (XYPlot) plot;
        xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY);
        xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY);

        //Domain axis(x axis)
        final Font xlbfont = chart.getXAxisFont();
        final Font xtkfont = chart.getXAxisTickFont();
        if (xlbfont != null) {
            xyplot.getDomainAxis().setLabelFont(xlbfont);
        }
        if (xtkfont != null) {
            xyplot.getDomainAxis().setTickLabelFont(xtkfont);
        }

        //Range axis(y axis)
        final Font ylbfont = chart.getYAxisFont();
        final Font ytkfont = chart.getYAxisTickFont();
        if (ylbfont != null) {
            xyplot.getRangeAxis().setLabelFont(ylbfont);
        }
        if (ytkfont != null) {
            xyplot.getRangeAxis().setTickLabelFont(ytkfont);
        }
    } else if (plot instanceof PiePlot) {
        plot.setOutlineStroke(null);
    }

    //callbacks for each area
    ChartRenderingInfo jfinfo = new ChartRenderingInfo();
    BufferedImage bi = jfchart.createBufferedImage(chart.getIntWidth(), chart.getIntHeight(),
            Transparency.TRANSLUCENT, jfinfo);

    //remove old areas
    if (chart.getChildren().size() > 20)
        chart.invalidate(); //improve performance if too many chart
    chart.getChildren().clear();

    if (Events.isListened(chart, Events.ON_CLICK, false) || chart.isShowTooltiptext()) {
        int j = 0;
        String preUrl = null;
        for (Iterator it = jfinfo.getEntityCollection().iterator(); it.hasNext();) {
            ChartEntity ce = (ChartEntity) it.next();
            final String url = ce.getURLText();

            //workaround JFreeChart's bug (skip replicate areas)
            if (url != null) {
                if (preUrl == null) {
                    preUrl = url;
                } else if (url.equals(preUrl)) { //start replicate, skip
                    break;
                }
            }

            //1. JFreeChartEntity area cover the whole chart, will "mask" other areas
            //2. LegendTitle area cover the whole legend, will "mask" each legend
            //3. PlotEntity cover the whole chart plotting araa, will "mask" each bar/line/area
            if (!(ce instanceof JFreeChartEntity)
                    && !(ce instanceof TitleEntity && ((TitleEntity) ce).getTitle() instanceof LegendTitle)
                    && !(ce instanceof PlotEntity)) {
                Area area = new Area();
                area.setParent(chart);
                area.setCoords(ce.getShapeCoords());
                area.setShape(ce.getShapeType());
                area.setId("area_" + chart.getId() + '_' + (j++));
                if (chart.isShowTooltiptext() && ce.getToolTipText() != null) {
                    area.setTooltiptext(ce.getToolTipText());
                }
                area.setAttribute("url", ce.getURLText());
                impl.render(chart, area, ce);
                if (chart.getAreaListener() != null) {
                    try {
                        chart.getAreaListener().onRender(area, ce);
                    } catch (Exception ex) {
                        throw UiException.Aide.wrap(ex);
                    }
                }
            }
        }
    }
    //clean up the "LEGEND_SEQ"
    //used for workaround LegendItemEntity.getSeries() always return 0
    //used for workaround TickLabelEntity no information
    chart.removeAttribute("LEGEND_SEQ");
    chart.removeAttribute("TICK_SEQ");

    try {
        //encode into png image format byte array
        return EncoderUtil.encode(bi, ImageFormat.PNG, true);
    } catch (java.io.IOException ex) {
        throw UiException.Aide.wrap(ex);
    }
}

From source file:org.openfaces.component.chart.impl.helpers.JFreeChartAdapter.java

public JFreeChartAdapter(Plot plot, Chart chart) {
    super(null, JFreeChart.DEFAULT_TITLE_FONT, plot, false);

    final boolean chartBackgroundPaintDefined = chart.getChartView().getBackgroundPaint() != null;
    if (chart.isLegendVisible()) {
        addSubtitle(new LegendAdapter(plot, chart));
    }/*from  ww w . j  a v  a  2  s  .  c  om*/

    if (chart.getTitle() != null) {
        setTitle(new TextTitleAdapter(chart));
    }

    if (chartBackgroundPaintDefined) {
        setBackgroundPaint(chart.getChartView().getBackgroundPaint());
    }

    //TODO: separate style properties

    StyleObjectModel cssChartModel = chart.getStyleObjectModel();
    if (cssChartModel != null) {
        if (!chartBackgroundPaintDefined) {
            setBackgroundPaint(cssChartModel.getBackground());
        }

        StyleBorderModel border = cssChartModel.getBorder();
        if (border != null && !border.isNone()) {
            setBorderPaint(border.getColor());
            setBorderVisible(true);
        } else {
            setBorderVisible(false);
        }
    }

    Float foregroundAlpha = chart.getChartView().getForegroundAlpha();
    if (foregroundAlpha != null) {
        plot.setForegroundAlpha(foregroundAlpha);
    }

    ChartNoDataMessage chartNoDataMessage = chart.getNoDataMessage();
    if (chartNoDataMessage != null && chartNoDataMessage.getText() != null) {
        plot.setNoDataMessage(chartNoDataMessage.getText());

        StyleObjectModel cssMessageModel = chartNoDataMessage.getStyleObjectModel();
        if (cssMessageModel != null) {
            plot.setNoDataMessagePaint(cssMessageModel.getColor());
            plot.setNoDataMessageFont(CSSUtil.getFont(cssMessageModel));
        }
    }
}

From source file:lucee.runtime.tag.Chart.java

private void set3d(Plot plot) {
    if (!show3d)/*from ww  w. ja va  2s.c o m*/
        return;

    plot.setForegroundAlpha(0.6f);

    if (plot instanceof CategoryPlot) {
        plot.setForegroundAlpha(0.8f);
        CategoryPlot cp = (CategoryPlot) plot;
        CategoryItemRenderer renderer = cp.getRenderer();
        if (renderer instanceof BarRenderer3D) {
            BarRenderer3D br3d = (BarRenderer3D) renderer;
            cp.setRenderer(new BarRenderer3DWrap(br3d, xoffset, yoffset));
        }

    } else if (plot instanceof PiePlot3D) {
        PiePlot3D pp3d = (PiePlot3D) plot;
        pp3d.setDepthFactor(0.10);
    }

    //CategoryItemRenderer renderer = plot.getRenderer();

}

From source file:com.appnativa.rare.ui.chart.jfreechart.ChartHandler.java

protected void customizeBasicPlot(final Plot plot, PlotInformation pi) {
    UIColor bg = null;//  ww  w  . j  a v a 2 s .c  om

    if (pi != null) {
        bg = pi.getBackgroundColor();
        plot.setForegroundAlpha(pi.getForegroundAlpha());

        if (pi.getBackgroundImage() != null) {
            UIImage img = pi.getBackgroundImage();

            if (img.isLoaded()) {
                plot.setBackgroundImage(img.getImage());
            } else {
                iImageObserver io = new iImageObserver() {
                    @Override
                    public void imageLoaded(UIImage image) {
                        try {
                            plot.setBackgroundImage(image.getImage());
                        } catch (Exception ignore) {
                        }
                    }
                };

                if (img.isImageLoaded(io)) {
                    plot.setBackgroundImage(img.getImage());
                }
            }
        }

        UIInsets in = pi.getMargin();

        if (in != null) {
            plot.setInsets(new RectangleInsets(in.top, in.left, in.bottom, in.right));
        }
    }

    if (bg == null) {
        bg = plotBackground;
    }

    if (bg != null) {
        plot.setBackgroundPaint(ChartHelper.getPaint(bg));
    }

    plot.setInsets(new RectangleInsets(12, 12, 12, 12));
}

From source file:org.operamasks.faces.render.graph.ChartRenderer.java

protected void setChartStyles(JFreeChart chart, UIChart comp) {
    Plot plot = chart.getPlot();

    RectangleInsets insets = plot.getInsets();
    Double tm = comp.getTopMargin();
    Double lm = comp.getLeftMargin();
    Double bm = comp.getBottomMargin();
    Double rm = comp.getRightMargin();
    if (tm == null || tm < 0)
        tm = insets.getTop();//from   ww  w .  ja  va2 s  . c om
    if (lm == null || lm < 0)
        lm = insets.getLeft();
    if (bm == null || bm < 0)
        bm = insets.getBottom();
    if (rm == null || rm < 0)
        rm = insets.getRight();
    plot.setInsets(new RectangleInsets(tm, lm, bm, rm));

    Paint color = comp.getBackgroundColor();
    if (color != null) {
        chart.setBackgroundPaint(color);
    }

    Image image = loadImage(comp.getBackgroundImage());
    if (image != null) {
        chart.setBackgroundImage(image);
        chart.setBackgroundImageAlignment(getImageAlign(comp.getBackgroundImagePosition()));
        chart.setBackgroundImageAlpha(comp.getBackgroundImageAlpha());
    }

    color = comp.getPlotColor();
    if (color != null) {
        plot.setBackgroundPaint(color);
    }

    Float alpha;
    if ((alpha = comp.getBackgroundAlpha()) != null) {
        plot.setBackgroundAlpha(alpha);
    }
    if ((alpha = comp.getForegroundAlpha()) != null) {
        plot.setForegroundAlpha(alpha);
    }

    image = loadImage(comp.getPlotImage());
    if (image != null) {
        plot.setBackgroundImage(image);
        plot.setBackgroundImageAlignment(getImageAlign(comp.getPlotImagePosition()));
        plot.setBackgroundImageAlpha(comp.getBackgroundImageAlpha());
    }

    Paint[] colorPalette = comp.getColorPalette();
    if (colorPalette != null) {
        plot.setDrawingSupplier(new CustomDrawingSupplier(colorPalette));
    } else {
        plot.setDrawingSupplier(new CustomDrawingSupplier());
    }
}

From source file:net.sf.jasperreports.engine.fill.DefaultChartTheme.java

/**
 *
 *///from w w w . j a v a2 s  . c o  m
protected void configurePlot(Plot plot) {
    plot.setOutlinePaint(null);

    if (getPlot().getOwnBackcolor() == null)// in a way, plot backcolor inheritence from chart is useless
    {
        plot.setBackgroundPaint(null);
    } else {
        plot.setBackgroundPaint(getPlot().getBackcolor());
    }

    float backgroundAlpha = getPlot().getBackgroundAlphaFloat() == null ? 1f
            : getPlot().getBackgroundAlphaFloat();
    float foregroundAlpha = getPlot().getForegroundAlphaFloat() == null ? 1f
            : getPlot().getForegroundAlphaFloat();
    plot.setBackgroundAlpha(backgroundAlpha);
    plot.setForegroundAlpha(foregroundAlpha);

    if (plot instanceof CategoryPlot) {
        // Handle rotation of the category labels.
        CategoryAxis axis = ((CategoryPlot) plot).getDomainAxis();
        // it's OK to use deprecated method here; avoiding it means attempting cast operations  
        double labelRotation = getLabelRotation();
        if (labelRotation == 90) {
            axis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
        } else if (labelRotation == -90) {
            axis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
        } else if (labelRotation < 0) {
            axis.setCategoryLabelPositions(
                    CategoryLabelPositions.createUpRotationLabelPositions((-labelRotation / 180.0) * Math.PI));
        } else if (labelRotation > 0) {
            axis.setCategoryLabelPositions(
                    CategoryLabelPositions.createDownRotationLabelPositions((labelRotation / 180.0) * Math.PI));
        }
    }

    // Set any color series
    SortedSet<JRSeriesColor> seriesColors = getPlot().getSeriesColors();
    if (seriesColors != null && seriesColors.size() > 0) {
        if (seriesColors.size() == 1) {
            // Add the single color to the beginning of the color cycle, using all the default
            // colors.  To replace the defaults you have to specify at least two colors.
            Paint[] colors = new Paint[DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length + 1];
            colors[0] = seriesColors.first().getColor();
            System.arraycopy(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE, 0, colors, 1,
                    DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length);
            plot.setDrawingSupplier(
                    new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
                            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
        } else if (seriesColors.size() > 1) {
            // Set up a custom drawing supplier that cycles through the user's colors
            // instead of the default colors.
            Color[] colors = new Color[seriesColors.size()];
            JRSeriesColor[] colorSequence = new JRSeriesColor[seriesColors.size()];
            seriesColors.toArray(colorSequence);
            for (int i = 0; i < colorSequence.length; i++) {
                colors[i] = colorSequence[i].getColor();
            }

            plot.setDrawingSupplier(
                    new DefaultDrawingSupplier(colors, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
                            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
                            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
                            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));
        }
    }
}

From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java

protected void setPlotBackground(Plot plot, JRChartPlot jrPlot) {
    PlotSettings plotSettings = getPlotSettings();
    Paint backgroundPaint = jrPlot.getOwnBackcolor();
    if (backgroundPaint == null && plotSettings.getBackgroundPaint() != null) {
        backgroundPaint = plotSettings.getBackgroundPaint().getPaint();
    }//from www.  j  a  v a  2 s  . c  o  m
    if (backgroundPaint == null) {
        backgroundPaint = ChartThemesConstants.TRANSPARENT_PAINT;
    }
    plot.setBackgroundPaint(backgroundPaint);

    Float backgroundAlpha = jrPlot.getBackgroundAlphaFloat();
    if (backgroundAlpha == null) {
        backgroundAlpha = plotSettings.getBackgroundAlpha();
    }
    if (backgroundAlpha != null)
        plot.setBackgroundAlpha(backgroundAlpha.floatValue());

    Float foregroundAlpha = jrPlot.getForegroundAlphaFloat();
    if (foregroundAlpha == null) {
        foregroundAlpha = plotSettings.getForegroundAlpha();
    }
    if (foregroundAlpha != null)
        plot.setForegroundAlpha(foregroundAlpha.floatValue());

    Image backgroundImage = plotSettings.getBackgroundImage() == null ? null
            : plotSettings.getBackgroundImage().getImage();
    if (backgroundImage != null) {
        plot.setBackgroundImage(backgroundImage);
        Integer backgroundImageAlignment = plotSettings.getBackgroundImageAlignment();
        if (backgroundImageAlignment != null) {
            plot.setBackgroundImageAlignment(backgroundImageAlignment.intValue());
        }
        Float backgroundImageAlpha = plotSettings.getBackgroundImageAlpha();
        if (backgroundImageAlpha != null) {
            plot.setBackgroundImageAlpha(backgroundImageAlpha.floatValue());
        }
    }
}

From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java

protected void setPlotBackground(Plot plot, JRChartPlot jrPlot) {
    PlotSettings plotSettings = getPlotSettings();
    Paint backgroundPaint = jrPlot.getOwnBackcolor();
    if (backgroundPaint == null && plotSettings.getBackgroundPaint() != null) {
        backgroundPaint = plotSettings.getBackgroundPaint().getPaint();
    }/*from   ww w .  ja v  a  2 s .com*/
    if (backgroundPaint == null) {
        backgroundPaint = ChartThemesConstants.TRANSPARENT_PAINT;
    }
    plot.setBackgroundPaint(backgroundPaint);

    Float backgroundAlpha = jrPlot.getBackgroundAlphaFloat();
    if (backgroundAlpha == null) {
        backgroundAlpha = plotSettings.getBackgroundAlpha();
    }
    if (backgroundAlpha != null)
        plot.setBackgroundAlpha(backgroundAlpha);

    Float foregroundAlpha = jrPlot.getForegroundAlphaFloat();
    if (foregroundAlpha == null) {
        foregroundAlpha = plotSettings.getForegroundAlpha();
    }
    if (foregroundAlpha != null)
        plot.setForegroundAlpha(foregroundAlpha);

    Image backgroundImage = plotSettings.getBackgroundImage() == null ? null
            : plotSettings.getBackgroundImage().getImage(getChartContext().getJasperReportsContext());
    if (backgroundImage != null) {
        plot.setBackgroundImage(backgroundImage);
        Integer backgroundImageAlignment = plotSettings.getBackgroundImageAlignment();
        if (backgroundImageAlignment != null) {
            plot.setBackgroundImageAlignment(backgroundImageAlignment);
        }
        Float backgroundImageAlpha = plotSettings.getBackgroundImageAlpha();
        if (backgroundImageAlpha != null) {
            plot.setBackgroundImageAlpha(backgroundImageAlpha);
        }
    }
}