Java Code Examples for org.jfree.chart.plot.Plot#setBackgroundAlpha()
The following examples show how to use
org.jfree.chart.plot.Plot#setBackgroundAlpha() .
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: GenericChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected void setPlotBackground(Plot p, JRChartPlot jrPlot) { Paint defaultBackgroundPaint = (Paint)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_BACKGROUND_PAINT); Float defaultBackgroundAlpha = (Float)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_BACKGROUND_ALPHA); Float defaultForegroundAlpha = (Float)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_FOREGROUND_ALPHA); Image defaultBackgroundImage = (Image)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_BACKGROUND_IMAGE); Integer defaultBackgroundImageAlignment = (Integer)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_BACKGROUND_IMAGE_ALIGNMENT); Float defaultBackgroundImageAlpha = (Float)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_BACKGROUND_IMAGE_ALPHA); Paint backgroundPaint = jrPlot.getOwnBackcolor() != null ? jrPlot.getOwnBackcolor() : defaultBackgroundPaint; if (backgroundPaint != null) { p.setBackgroundPaint(backgroundPaint); } Float backgroundAlpha = jrPlot.getBackgroundAlphaFloat() != null ? jrPlot.getBackgroundAlphaFloat() : defaultBackgroundAlpha; if (backgroundAlpha != null) p.setBackgroundAlpha(backgroundAlpha); Float foregroundAlpha = jrPlot.getForegroundAlphaFloat() != null ? jrPlot.getForegroundAlphaFloat() : defaultForegroundAlpha; if (foregroundAlpha != null) p.setForegroundAlpha(foregroundAlpha); if (defaultBackgroundImage != null) { p.setBackgroundImage(defaultBackgroundImage); if (defaultBackgroundImageAlignment != null) { p.setBackgroundImageAlignment(defaultBackgroundImageAlignment); } if (defaultBackgroundImageAlpha != null) { p.setBackgroundImageAlpha(defaultBackgroundImageAlpha); } } }
Example 2
Source File: SimpleChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 4 votes |
protected void setPlotBackground(Plot plot, JRChartPlot jrPlot) { PlotSettings plotSettings = getPlotSettings(); Paint backgroundPaint = jrPlot.getOwnBackcolor(); if (backgroundPaint == null && plotSettings.getBackgroundPaint() != null) { backgroundPaint = plotSettings.getBackgroundPaint().getPaint(); } 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); } } }