List of usage examples for org.jfree.chart.plot Plot setOutlineVisible
public void setOutlineVisible(boolean visible)
From source file:net.nosleep.superanalyzer.util.Misc.java
public static void formatChart(Plot plot) { plot.setBackgroundPaint(Color.white); plot.setOutlineVisible(false); plot.setNoDataMessage(Misc.getString("NO_DATA_TO_DISPLAY")); if ((plot instanceof XYPlot)) { XYPlot xyPlot = (XYPlot) plot;//w w w . ja va 2 s . c o m xyPlot.setDomainGridlinePaint(Color.gray); xyPlot.setRangeGridlinePaint(Color.gray); } }
From source file:org.eobjects.datacleaner.util.ChartUtils.java
public static void applyStyles(JFreeChart chart) { TextTitle title = chart.getTitle();/*from w w w .ja va2 s. c om*/ if (title != null) { title.setFont(WidgetUtils.FONT_HEADER1); title.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST); } for (int i = 0; i < chart.getSubtitleCount(); i++) { Title subtitle = chart.getSubtitle(i); if (subtitle instanceof TextTitle) { ((TextTitle) subtitle).setFont(WidgetUtils.FONT_NORMAL); } } LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setItemFont(WidgetUtils.FONT_SMALL); } // transparent background chart.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST); chart.setBorderVisible(false); final Plot plot = chart.getPlot(); plot.setInsets(new RectangleInsets(UnitType.ABSOLUTE, 0d, 0d, 0d, 0d)); plot.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST); plot.setOutlinePaint(WidgetUtils.BG_COLOR_BRIGHTEST); plot.setOutlineVisible(true); if (plot instanceof PiePlot) { // tweaks for pie charts final PiePlot piePlot = (PiePlot) plot; piePlot.setBaseSectionOutlinePaint(WidgetUtils.BG_COLOR_DARK); piePlot.setBaseSectionOutlineStroke(normalStroke); piePlot.setLabelFont(WidgetUtils.FONT_SMALL); piePlot.setLabelBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHT); piePlot.setLabelOutlineStroke(normalStroke); piePlot.setLabelPaint(WidgetUtils.BG_COLOR_DARK); piePlot.setSectionOutlinesVisible(false); piePlot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE); } else if (plot instanceof CategoryPlot) { // tweaks for bar charts final CategoryPlot categoryPlot = (CategoryPlot) plot; int columnCount = categoryPlot.getDataset().getColumnCount(); if (columnCount > 1) { categoryPlot.setDomainGridlinesVisible(true); } else { categoryPlot.setDomainGridlinesVisible(false); } categoryPlot.setDomainGridlinePaint(WidgetUtils.BG_COLOR_DARK); categoryPlot.setDomainGridlinePosition(CategoryAnchor.END); categoryPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.setDrawingSupplier(new DCDrawingSupplier()); final CategoryItemRenderer renderer = categoryPlot.getRenderer(); renderer.setBaseOutlinePaint(WidgetUtils.BG_COLOR_DARK); renderer.setBaseOutlineStroke(wideStroke); if (renderer instanceof BarRenderer) { BarRenderer barRenderer = (BarRenderer) renderer; barRenderer.setShadowPaint(WidgetUtils.BG_COLOR_BRIGHT); barRenderer.setBarPainter(new StandardBarPainter()); } } else if (plot instanceof XYPlot) { // tweaks for line charts final XYPlot xyPlot = (XYPlot) plot; xyPlot.setDrawingSupplier(new DCDrawingSupplier()); xyPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL); xyPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); xyPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL); xyPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); final XYItemRenderer renderer = xyPlot.getRenderer(); final int seriesCount = xyPlot.getSeriesCount(); for (int i = 0; i < seriesCount; i++) { renderer.setSeriesStroke(i, wideStroke); } } }
From source file:org.datacleaner.util.ChartUtils.java
public static void applyStyles(JFreeChart chart) { TextTitle title = chart.getTitle();/*from ww w .j a va 2 s . c om*/ if (title != null) { title.setFont(WidgetUtils.FONT_HEADER1); title.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST); } for (int i = 0; i < chart.getSubtitleCount(); i++) { Title subtitle = chart.getSubtitle(i); if (subtitle instanceof TextTitle) { ((TextTitle) subtitle).setFont(WidgetUtils.FONT_NORMAL); } } LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setItemFont(WidgetUtils.FONT_SMALL); } // transparent background chart.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST); chart.setBorderVisible(false); final Plot plot = chart.getPlot(); plot.setInsets(new RectangleInsets(UnitType.ABSOLUTE, 0d, 0d, 0d, 0d)); plot.setBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHTEST); plot.setOutlinePaint(WidgetUtils.BG_COLOR_BRIGHTEST); plot.setOutlineVisible(true); if (plot instanceof PiePlot) { // tweaks for pie charts final PiePlot piePlot = (PiePlot) plot; piePlot.setBaseSectionOutlinePaint(WidgetUtils.BG_COLOR_DARK); piePlot.setBaseSectionOutlineStroke(STROKE_NORMAL); piePlot.setLabelFont(WidgetUtils.FONT_SMALL); piePlot.setLabelBackgroundPaint(WidgetUtils.BG_COLOR_BRIGHT); piePlot.setLabelOutlineStroke(STROKE_NORMAL); piePlot.setLabelPaint(WidgetUtils.BG_COLOR_DARK); piePlot.setSectionOutlinesVisible(false); piePlot.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE); piePlot.setDrawingSupplier(new DCDrawingSupplier()); } else if (plot instanceof CategoryPlot) { // tweaks for bar charts final CategoryPlot categoryPlot = (CategoryPlot) plot; int columnCount = categoryPlot.getDataset().getColumnCount(); if (columnCount > 1) { categoryPlot.setDomainGridlinesVisible(true); } else { categoryPlot.setDomainGridlinesVisible(false); } categoryPlot.setDomainGridlinePaint(WidgetUtils.BG_COLOR_DARK); categoryPlot.setDomainGridlinePosition(CategoryAnchor.END); categoryPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); categoryPlot.setDrawingSupplier(new DCDrawingSupplier()); final CategoryItemRenderer renderer = categoryPlot.getRenderer(); renderer.setBaseOutlinePaint(WidgetUtils.BG_COLOR_DARK); renderer.setBaseOutlineStroke(STROKE_WIDE); if (renderer instanceof BarRenderer) { BarRenderer barRenderer = (BarRenderer) renderer; barRenderer.setShadowPaint(WidgetUtils.BG_COLOR_BRIGHT); barRenderer.setBarPainter(new StandardBarPainter()); } } else if (plot instanceof XYPlot) { // tweaks for line charts final XYPlot xyPlot = (XYPlot) plot; xyPlot.setDrawingSupplier(new DCDrawingSupplier()); xyPlot.getDomainAxis().setLabelFont(WidgetUtils.FONT_SMALL); xyPlot.getDomainAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); xyPlot.getRangeAxis().setLabelFont(WidgetUtils.FONT_SMALL); xyPlot.getRangeAxis().setTickLabelFont(WidgetUtils.FONT_SMALL); final XYItemRenderer renderer = xyPlot.getRenderer(); final int seriesCount = xyPlot.getSeriesCount(); for (int i = 0; i < seriesCount; i++) { renderer.setSeriesStroke(i, STROKE_WIDE); } } }
From source file:uk.ac.lkl.cram.ui.chart.AbstractChartMaker.java
/** * Apply some defaults to a chart, including background paint * and font./*from ww w . j a v a 2s .c o m*/ * @param chart the chart to which defaults should be applied */ private void setChartDefaults(JFreeChart chart) { Paint backgroundPaint = UIManager.getColor("InternalFrame.background"); //Set the background colour of the chart chart.setBackgroundPaint(backgroundPaint); //Set the background colour of the plot to be the same as the chart Plot plot = chart.getPlot(); plot.setBackgroundPaint(backgroundPaint); //No outline around the bars plot.setOutlineVisible(false); //Get the legend LegendTitle legend = chart.getLegend(); //Set the font of the legend to be the same as the platform legend.setItemFont(UIManager.getFont("Label.font")); //Set the background colour of the legend to be the same as the platform legend.setBackgroundPaint(backgroundPaint); //No frame around the legend legend.setFrame(BlockBorder.NONE); //Locate the legend to the right of the chart legend.setPosition(RectangleEdge.RIGHT); }
From source file:msi.gama.outputs.layers.charts.ChartJFreeChartOutput.java
@Override public void initChart(final IScope scope, final String chartname) { super.initChart(scope, chartname); initRenderer(scope);//from w w w.j a v a2 s.c om final Plot plot = chart.getPlot(); chart.setBorderVisible(false); plot.setOutlineVisible(false); chart.setTitle(this.getName()); chart.getTitle().setVisible(true); chart.getTitle().setFont(getTitleFont()); if (!this.getTitleVisible(scope)) { chart.getTitle().setVisible(false); } if (textColor != null) { chart.getTitle().setPaint(textColor); } if (backgroundColor == null) { plot.setBackgroundPaint(null); chart.setBackgroundPaint(null); chart.setBorderPaint(null); if (chart.getLegend() != null) { chart.getLegend().setBackgroundPaint(null); } } else { final Color bg = backgroundColor; chart.setBackgroundPaint(bg); plot.setBackgroundPaint(bg); chart.setBorderPaint(bg); if (chart.getLegend() != null) { chart.getLegend().setBackgroundPaint(bg); } } if (chart.getLegend() != null) { chart.getLegend().setItemFont(getLegendFont()); chart.getLegend().setFrame(BlockBorder.NONE); if (textColor != null) { chart.getLegend().setItemPaint(textColor); } } chart.addProgressListener(this); }
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. com*/ } 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:lucee.runtime.tag.Chart.java
private void setBackground(JFreeChart chart, Plot plot) { //Color bg = backgroundcolor==null?databackgroundcolor:backgroundcolor; chart.setBackgroundPaint(backgroundcolor); plot.setBackgroundPaint(databackgroundcolor); chart.setBorderPaint(databackgroundcolor); plot.setOutlineVisible(false); // Pie//from w w w. j a v a 2s .c o m if (plot instanceof PiePlot) { PiePlot pp = (PiePlot) plot; pp.setLabelOutlinePaint(backgroundcolor); pp.setLabelBackgroundPaint(backgroundcolor); pp.setLabelShadowPaint(backgroundcolor); pp.setShadowPaint(backgroundcolor); } // Bar /*if(plot instanceof CategoryPlot) { CategoryPlot cp=(CategoryPlot) plot; }*/ }
From source file:net.sf.fspdfs.chartthemes.simple.SimpleChartTheme.java
/** * *//* w w w . j a va2 s . c o m*/ protected void configurePlot(Plot plot, JRChartPlot jrPlot) { RectangleInsets padding = getPlotSettings().getPadding(); if (padding != null) plot.setInsets(padding); Boolean plotOutlineVisible = getPlotSettings().getOutlineVisible(); if (plotOutlineVisible == null || plotOutlineVisible.booleanValue()) { Paint outlinePaint = getPlotSettings().getOutlinePaint() == null ? null : getPlotSettings().getOutlinePaint().getPaint(); if (outlinePaint != null) plot.setOutlinePaint(outlinePaint); Stroke plotOutlineStroke = getPlotSettings().getOutlineStroke(); if (plotOutlineStroke != null) plot.setOutlineStroke(plotOutlineStroke); plot.setOutlineVisible(true); } else { plot.setOutlineVisible(false); } setPlotBackground(plot, jrPlot); setPlotDrawingDefaults(plot, jrPlot); if (plot instanceof CategoryPlot) { handleCategoryPlotSettings((CategoryPlot) plot, jrPlot); } if (plot instanceof XYPlot) { handleXYPlotSettings((XYPlot) plot, jrPlot); } }
From source file:net.sf.jasperreports.chartthemes.simple.SimpleChartTheme.java
/** * *//*w w w. j ava 2 s . co m*/ protected void configurePlot(Plot plot, JRChartPlot jrPlot) { RectangleInsets padding = getPlotSettings().getPadding(); if (padding != null) plot.setInsets(padding); Boolean plotOutlineVisible = getPlotSettings().getOutlineVisible(); if (plotOutlineVisible == null || plotOutlineVisible) { Paint outlinePaint = getPlotSettings().getOutlinePaint() == null ? null : getPlotSettings().getOutlinePaint().getPaint(); if (outlinePaint != null) plot.setOutlinePaint(outlinePaint); Stroke plotOutlineStroke = getPlotSettings().getOutlineStroke(); if (plotOutlineStroke != null) plot.setOutlineStroke(plotOutlineStroke); plot.setOutlineVisible(true); } else { plot.setOutlineVisible(false); } setPlotBackground(plot, jrPlot); setPlotDrawingDefaults(plot, jrPlot); if (plot instanceof CategoryPlot) { handleCategoryPlotSettings((CategoryPlot) plot, jrPlot); } if (plot instanceof XYPlot) { handleXYPlotSettings((XYPlot) plot, jrPlot); } }
From source file:net.sf.fspdfs.chartthemes.spring.GenericChartTheme.java
/** * *///w w w. j a v a 2s . c o m protected void configurePlot(Plot p, JRChartPlot jrPlot) { RectangleInsets defaultPlotInsets = (RectangleInsets) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_INSETS); Paint defaultPlotOutlinePaint = (Paint) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_OUTLINE_PAINT); Stroke defaultPlotOutlineStroke = (Stroke) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_OUTLINE_STROKE); Boolean defaultPlotOutlineVisible = (Boolean) getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_OUTLINE_VISIBLE); if (defaultPlotInsets != null) p.setInsets(defaultPlotInsets); if (defaultPlotOutlineVisible != null) { if (defaultPlotOutlineVisible.booleanValue()) { if (defaultPlotOutlinePaint != null) p.setOutlinePaint(defaultPlotOutlinePaint); if (defaultPlotOutlineStroke != null) p.setOutlineStroke(defaultPlotOutlineStroke); p.setOutlineVisible(true); } else { p.setOutlineVisible(false); } } setPlotBackground(p, jrPlot); if (p instanceof CategoryPlot) { handleCategoryPlotSettings((CategoryPlot) p, jrPlot); } setPlotDrawingDefaults(p, jrPlot); }