List of usage examples for org.jfree.chart.plot Plot setBackgroundImageAlignment
public void setBackgroundImageAlignment(int alignment)
From source file:org.owasp.jbrofuzz.graph.canvas.ResponseSizeChart.java
public ChartPanel getPlotCanvas() { final JFreeChart chart = ChartFactory.createBarChart("JBroFuzz Response Size Bar Chart", // chart title "File Name", // domain axis label "Response Size (bytes)", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? true // URLs? );/* ww w. ja v a 2s. c o m*/ final Plot plot = chart.getPlot(); plot.setBackgroundImage(ImageCreator.IMG_OWASP_MED.getImage()); plot.setBackgroundImageAlignment(Align.TOP_RIGHT); final CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer(); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); return new ChartPanel(chart); }
From source file:org.owasp.jbrofuzz.graph.canvas.ResponseTimeChart.java
public ChartPanel getPlotCanvas() { final JFreeChart chart = ChartFactory.createBarChart("JBroFuzz Response Time Bar Chart", // chart title "File Name", // domain axis label "Response Time (ms)", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? true // URLs? );/*from ww w. j a v a 2 s .c om*/ final Plot plot = chart.getPlot(); plot.setBackgroundImage(ImageCreator.IMG_OWASP_MED.getImage()); plot.setBackgroundImageAlignment(Align.TOP_RIGHT); final CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer(); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); return new ChartPanel(chart); }
From source file:org.owasp.jbrofuzz.graph.canvas.ResponseHeaderSizeChart.java
public ChartPanel getPlotCanvas() { final JFreeChart chart = ChartFactory.createBarChart("JBroFuzz Response Header Size Bar Chart", // chart title "File Name", // domain axis label "Response Header Size (bytes)", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? true // URLs? );/*from www . j a v a 2 s .c o m*/ final Plot plot = chart.getPlot(); plot.setBackgroundImage(ImageCreator.IMG_OWASP_MED.getImage()); plot.setBackgroundImageAlignment(Align.TOP_RIGHT); final CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer(); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); return new ChartPanel(chart); }
From source file:org.owasp.jbrofuzz.graph.canvas.StatusCodeChart.java
public ChartPanel getPlotCanvas() { final JFreeChart chart = ChartFactory.createPieChart("JBroFuzz Status Code Pie Chart", dataset, true, // legend? true, // tooltips? false // URLs? );// www . j a v a2s .c om final Plot plot = chart.getPlot(); plot.setBackgroundImage(ImageCreator.IMG_OWASP_MED.getImage()); plot.setBackgroundImageAlignment(Align.TOP_RIGHT); return new ChartPanel(chart); }
From source file:org.owasp.jbrofuzz.graph.canvas.JaccardIndexChart.java
public ChartPanel getPlotCanvas() { final JFreeChart chart = ChartFactory.createBarChart("JBroFuzz Jaccard Index Bar Chart", // chart title "File Name", // domain axis label "Jaccard Similarity Coefficient", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? true // URLs? );//w w w. j a v a 2s .co m final Plot plot = chart.getPlot(); plot.setBackgroundImage(ImageCreator.IMG_OWASP_MED.getImage()); plot.setBackgroundImageAlignment(Align.TOP_RIGHT); final CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer(); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); return new ChartPanel(chart); }
From source file:org.owasp.jbrofuzz.graph.canvas.HammingDistanceChart.java
public ChartPanel getPlotCanvas() { final JFreeChart chart = ChartFactory.createBarChart("JBroFuzz Hamming Distance Bar Chart", // chart title "File Name", // domain axis label "Hamming Distance", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? true // URLs? );/*from w w w. ja v a 2 s .com*/ final Plot plot = chart.getPlot(); plot.setBackgroundImage(ImageCreator.IMG_OWASP_MED.getImage()); plot.setBackgroundImageAlignment(Align.TOP_RIGHT); final CategoryItemRenderer renderer = chart.getCategoryPlot().getRenderer(); renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); return new ChartPanel(chart); }
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 w w w .j a va2 s. c o m*/ 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.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(); }/*ww w . j av a2 s . c om*/ 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 w w w .j av a2 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); 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); } } }
From source file:com.naryx.tagfusion.cfm.tag.awt.cfCHART.java
private void setBackgroundImage(cfSession _Session, Plot plot, cfCHARTIMAGEData imgData) throws cfmRunTimeException { // If a background image wasn't specified then just return if (imgData == null) return;//from w w w . j av a 2s .c o m // Determine the location of the background image String file = imgData.getFile(); if (imgData.isUriDirectory()) { file = FileUtils.getRealPath(_Session.REQ, file); } // Determine the type of the background image byte imgType; String lowerCaseFile = file.toLowerCase(); if (lowerCaseFile.endsWith(".gif")) { imgType = imageOps.GIF; } else if (lowerCaseFile.endsWith(".jpg") || lowerCaseFile.endsWith(".jpeg")) { imgType = imageOps.JPG; } else { throw newRunTimeException("The background image must be a GIF or JPEG."); } // Load and set the background image plot.setBackgroundImage(com.nary.awt.image.imageOps.loadImage(file, imgType)); // Set the alignment of the background image String alignment = imgData.getAlignment(); if (alignment.equals("top_left")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.TOP_LEFT); else if (alignment.equals("top")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.TOP); else if (alignment.equals("top_right")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.TOP_RIGHT); else if (alignment.equals("left")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.LEFT); else if (alignment.equals("center")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.CENTER); else if (alignment.equals("right")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.RIGHT); else if (alignment.equals("bottom_left")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.BOTTOM_LEFT); else if (alignment.equals("bottom")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.BOTTOM); else if (alignment.equals("bottom_right")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.BOTTOM_RIGHT); else if (alignment.equals("fit_horizontal")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.FIT_HORIZONTAL); else if (alignment.equals("fit_vertical")) plot.setBackgroundImageAlignment(org.jfree.ui.Align.FIT_VERTICAL); else plot.setBackgroundImageAlignment(org.jfree.ui.Align.FIT); }