List of usage examples for org.jfree.chart.plot Plot setNoDataMessageFont
public void setNoDataMessageFont(Font font)
From source file:org.pentaho.plugin.jfreereport.reportcharts.MultiPieChartExpression.java
protected void configureSubChart(final JFreeChart chart) { final TextTitle chartTitle = chart.getTitle(); if (chartTitle != null) { if (getPieTitleFont() != null) { chartTitle.setFont(getPieTitleFont()); } else {/*from www . j a v a2 s .c o m*/ final Font titleFont = Font.decode(getTitleFont()); chartTitle.setFont(titleFont); } } if (isAntiAlias() == false) { chart.setAntiAlias(false); } final LegendTitle chLegend = chart.getLegend(); if (chLegend != null) { final RectangleEdge loc = translateEdge(getLegendLocation().toLowerCase()); if (loc != null) { chLegend.setPosition(loc); } if (getLegendFont() != null) { chLegend.setItemFont(Font.decode(getLegendFont())); } if (!isDrawLegendBorder()) { chLegend.setBorder(BlockBorder.NONE); } if (getLegendBackgroundColor() != null) { chLegend.setBackgroundPaint(getLegendBackgroundColor()); } if (getLegendTextColor() != null) { chLegend.setItemPaint(getLegendTextColor()); } } final Plot plot = chart.getPlot(); plot.setNoDataMessageFont(Font.decode(getLabelFont())); final String pieNoData = getPieNoDataMessage(); if (pieNoData != null) { plot.setNoDataMessage(pieNoData); } else { final String message = getNoDataMessage(); if (message != null) { plot.setNoDataMessage(message); } } }
From source file:org.pentaho.plugin.jfreereport.reportcharts.AbstractChartExpression.java
protected void configureChart(final JFreeChart chart) { // Misc Properties final TextTitle chartTitle = chart.getTitle(); if (chartTitle != null) { final Font titleFont = Font.decode(getTitleFont()); chartTitle.setFont(titleFont);/*from w w w . java 2s. c om*/ } if (isAntiAlias() == false) { chart.setAntiAlias(false); } chart.setBorderVisible(isShowBorder()); final Color backgroundColor = parseColorFromString(getBackgroundColor()); if (backgroundColor != null) { chart.setBackgroundPaint(backgroundColor); } if (plotBackgroundColor != null) { chart.getPlot().setBackgroundPaint(plotBackgroundColor); } chart.getPlot().setBackgroundAlpha(plotBackgroundAlpha); chart.getPlot().setForegroundAlpha(plotForegroundAlpha); final Color borderCol = parseColorFromString(getBorderColor()); if (borderCol != null) { chart.setBorderPaint(borderCol); } //remove legend if showLegend = false if (!isShowLegend()) { chart.removeLegend(); } else { //if true format legend final LegendTitle chLegend = chart.getLegend(); if (chLegend != null) { final RectangleEdge loc = translateEdge(legendLocation.toLowerCase()); if (loc != null) { chLegend.setPosition(loc); } if (getLegendFont() != null) { chLegend.setItemFont(Font.decode(getLegendFont())); } if (!isDrawLegendBorder()) { chLegend.setBorder(BlockBorder.NONE); } if (legendBackgroundColor != null) { chLegend.setBackgroundPaint(legendBackgroundColor); } if (legendTextColor != null) { chLegend.setItemPaint(legendTextColor); } } } final Plot plot = chart.getPlot(); plot.setNoDataMessageFont(Font.decode(getLabelFont())); final String message = getNoDataMessage(); if (message != null) { plot.setNoDataMessage(message); } plot.setOutlineVisible(isChartSectionOutline()); if (backgroundImage != null) { if (plotImageCache != null) { plot.setBackgroundImage(plotImageCache); } else { final ExpressionRuntime expressionRuntime = getRuntime(); final ProcessingContext context = expressionRuntime.getProcessingContext(); final ResourceKey contentBase = context.getContentBase(); final ResourceManager manager = context.getResourceManager(); try { final ResourceKey key = createKeyFromString(manager, contentBase, backgroundImage); final Resource resource = manager.create(key, null, Image.class); final Image image = (Image) resource.getResource(); plot.setBackgroundImage(image); plotImageCache = image; } catch (Exception e) { logger.error("ABSTRACTCHARTEXPRESSION.ERROR_0007_ERROR_RETRIEVING_PLOT_IMAGE", e); //$NON-NLS-1$ throw new IllegalStateException("Failed to process chart"); } } } }
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 www .j ava 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)); } } }