List of usage examples for org.jfree.chart JFreeChart createBufferedImage
public BufferedImage createBufferedImage(int width, int height)
From source file:playground.christoph.evacuation.analysis.EvacuationTimePictureWriter.java
/** * Writes the given JFreeChart to the kmz file specified for the kmz writer attribute of this class. * @param filename the filename to use in the kmz * @param chart/*from w w w . j a va 2s . co m*/ * @throws IOException */ private void writeChartToKmz(final String filename, final JFreeChart chart, int height, int width) throws IOException { byte[] img; img = ChartUtilities.encodeAsPNG(chart.createBufferedImage(height, width)); this.kmzWriter.addNonKMLFile(img, filename); }
From source file:biblioteca.database2.controladores.ControladorEstadisticas.java
public ArrayList<Element> estadisticasDocumentosDescargados(String dow, String dom, String month, String year, String tipo_usuario, String[] franja, String[] desde, String[] hasta, String area, String autor, String doc_tipo, String usuario, boolean todos, int salida) throws BadElementException, MalformedURLException, IOException { ArrayList<Element> Salida = new ArrayList<Element>(6); BufferedImage bufferedImage;/*from w w w. j a va 2s . c om*/ Image image; ResultSet rs = new DaoEstadisticas().documentosMasDescargados(dow, dom, month, year, tipo_usuario, franja, desde, hasta, area, autor, doc_tipo, usuario, todos); int total = 0; ArrayList<ArrayList<String>> resultadosTabla = biblioteca.reportes.PdfCreator.resultSetToArrayList(rs); ArrayList<String> Array2DtoArrayPlane = biblioteca.reportes.PdfCreator.Array2DtoArrayPlane(resultadosTabla, 1, 2); for (int i = 1; i < resultadosTabla.size(); i++) { total += Integer.parseInt(resultadosTabla.get(i).get(resultadosTabla.get(i).size() - 1)); } PdfPTable tabla = biblioteca.reportes.PdfCreator.arrayListToStatisticTable(resultadosTabla, total, salida); Salida.add(tabla); Salida.add(new Paragraph("\r\n")); Salida.add(new Paragraph("* Diagrama de Pastel y Diagrama de Barras: Documentos Descargados")); JFreeChart chart = ChartCreator.generatePieChart(ChartCreator.asignarPieDataset(Array2DtoArrayPlane), "Documentos Descargados"); bufferedImage = chart.createBufferedImage(500, 600); image = Image.getInstance(EncoderUtil.encode(bufferedImage, "png")); image.scaleAbsolute(250, 300); image.setAlignment(Image.MIDDLE); Salida.add(image); Salida.add(new Paragraph("\r\n")); chart = ChartCreator.generateBarChart(ChartCreator.asignarBarDataset(Array2DtoArrayPlane), "Documentos Descargados", "Identificador Documento", "Numero de Descargados"); bufferedImage = chart.createBufferedImage(1000, 500); image = Image.getInstance(EncoderUtil.encode(bufferedImage, "png")); image.scaleAbsolute(500, 250); image.setAlignment(Image.MIDDLE); Salida.add(image); return Salida; }
From source file:biblioteca.database2.controladores.ControladorEstadisticas.java
public ArrayList<Element> estadisticasDocumentosConsultados(String dow, String dom, String month, String year, String tipo_usuario, String[] franja, String[] desde, String[] hasta, String area, String autor, String doc_tipo, String usuario, boolean todos, int salida) throws BadElementException, MalformedURLException, IOException { ArrayList<Element> Salida = new ArrayList<Element>(6); BufferedImage bufferedImage;/*from ww w.ja v a 2s. c o m*/ Image image; ResultSet rs = new DaoEstadisticas().documentosMasConsultados(dow, dom, month, year, tipo_usuario, franja, desde, hasta, area, autor, doc_tipo, usuario, todos); int total = 0; ArrayList<ArrayList<String>> resultadosTabla = biblioteca.reportes.PdfCreator.resultSetToArrayList(rs); ArrayList<String> Array2DtoArrayPlane = biblioteca.reportes.PdfCreator.Array2DtoArrayPlane(resultadosTabla, 0, 2); for (int i = 1; i < resultadosTabla.size(); i++) { total += Integer.parseInt(resultadosTabla.get(i).get(resultadosTabla.get(i).size() - 1)); } PdfPTable tabla = biblioteca.reportes.PdfCreator.arrayListToStatisticTable(resultadosTabla, total, salida); Salida.add(tabla); Salida.add(new Paragraph("\r\n")); Salida.add(new Paragraph("* Diagrama de Pastel y Diagrama de Barras: Documentos Consultados")); JFreeChart chart = ChartCreator.generatePieChart(ChartCreator.asignarPieDataset(Array2DtoArrayPlane), "Documentos Consultados"); bufferedImage = chart.createBufferedImage(500, 600); image = Image.getInstance(EncoderUtil.encode(bufferedImage, "png")); image.scaleAbsolute(250, 300); image.setAlignment(Image.MIDDLE); Salida.add(image); Salida.add(new Paragraph("\r\n")); chart = ChartCreator.generateBarChart(ChartCreator.asignarBarDataset(Array2DtoArrayPlane), "Documentos Consultados", "Identificador Documento", "Numero de Consultas"); bufferedImage = chart.createBufferedImage(1000, 500); image = Image.getInstance(EncoderUtil.encode(bufferedImage, "png")); image.scaleAbsolute(500, 250); image.setAlignment(Image.MIDDLE); Salida.add(image); return Salida; }
From source file:playground.christoph.evacuation.analysis.EvacuationTimePictureWriter.java
private ScreenOverlayType createHistogram(String transportMode, Map<Id, Double> evacuationTimes) throws IOException { /*//from w w w. j a v a 2 s . c om * Remove NaN entries from the List */ List<Double> listWithoutNaN = new ArrayList<Double>(); for (Double d : evacuationTimes.values()) if (!d.isNaN()) listWithoutNaN.add(d); /* * If trip with significant to high evacuation times should be cut off */ if (limitMaxEvacuationTime) { double cutOffValue = meanEvacuationTime + standardDeviation * evacuationTimeCutOffFactor; ListIterator<Double> iter = listWithoutNaN.listIterator(); while (iter.hasNext()) { double value = iter.next(); if (value > cutOffValue) iter.remove(); } } double[] array = new double[listWithoutNaN.size()]; int i = 0; for (double d : listWithoutNaN) array[i++] = d; JFreeChart chart = createHistogramChart(transportMode, array); BufferedImage chartImage = chart.createBufferedImage(OVERALLHISTOGRAMWIDTH, OVERALLHISTOGRAMHEIGHT); BufferedImage image = new BufferedImage(OVERALLHISTOGRAMWIDTH, OVERALLHISTOGRAMHEIGHT, BufferedImage.TYPE_4BYTE_ABGR); // clone image and set alpha value for (int x = 0; x < OVERALLHISTOGRAMWIDTH; x++) { for (int y = 0; y < OVERALLHISTOGRAMHEIGHT; y++) { int rgb = chartImage.getRGB(x, y); Color c = new Color(rgb); int r = c.getRed(); int b = c.getBlue(); int g = c.getGreen(); int argb = 225 << 24 | r << 16 | g << 8 | b; // 225 as transparency value image.setRGB(x, y, argb); } } byte[] imageBytes = bufferedImageToByteArray(image); this.kmzWriter.addNonKMLFile(imageBytes, transportMode + OVERALLHISTROGRAM); ScreenOverlayType overlay = kmlObjectFactory.createScreenOverlayType(); LinkType icon = kmlObjectFactory.createLinkType(); icon.setHref(transportMode + OVERALLHISTROGRAM); overlay.setIcon(icon); overlay.setName("Histogram " + transportMode); // place the image top right Vec2Type overlayXY = kmlObjectFactory.createVec2Type(); overlayXY.setX(0.0); overlayXY.setY(1.0); overlayXY.setXunits(UnitsEnumType.FRACTION); overlayXY.setYunits(UnitsEnumType.FRACTION); overlay.setOverlayXY(overlayXY); Vec2Type screenXY = kmlObjectFactory.createVec2Type(); screenXY.setX(0.02); screenXY.setY(0.98); screenXY.setXunits(UnitsEnumType.FRACTION); screenXY.setYunits(UnitsEnumType.FRACTION); overlay.setScreenXY(screenXY); return overlay; }
From source file:org.jgrasstools.gears.ui.OmsMatrixCharter.java
@Execute public void chart() throws Exception { if (inData == null && inDataXY == null) { throw new ModelsIllegalargumentException("At least one of the datasets need to be valid.", this, pm); }//from w ww . j av a 2 s. com if (doDump) { checkNull(inChartPath); } JFreeChart chart = null; if (pType == 0) { chart = doLineChart(); } else { chart = doBarChart(); } if (inSubTitle != null) { TextTitle subTitle = new TextTitle(inSubTitle); chart.addSubtitle(subTitle); } chart.setTextAntiAlias(true); if (doDump) { File chartFile = new File(inChartPath); if (!chartFile.getName().endsWith(".png")) { chartFile = FileUtilities.substituteExtention(chartFile, "png"); } BufferedImage bufferedImage = chart.createBufferedImage(pWidth, pHeight); ImageIO.write(bufferedImage, "png", chartFile); } if (doChart) { ChartPanel cp = new ChartPanel(chart); cp.setDomainZoomable(true); cp.setRangeZoomable(true); ApplicationFrame af = new ApplicationFrame(""); af.setContentPane(cp); af.setPreferredSize(new Dimension(pWidth, pHeight)); af.pack(); af.setVisible(true); RefineryUtilities.centerFrameOnScreen(af); } }
From source file:ImageProcessing.RGBHistogram_GUI.java
public RGBHistogram_GUI(Component callerComponent) { //callerComponent is used only to determine the position of this //frame when called. initComponents();//from w ww.ja va2 s.com this.setLocationRelativeTo(callerComponent); //Determine the chart width & height for displaying. int chartLabelHeight = sourceImageGreenHistogram.getHeight(); int chartLabelWidth = sourceImageGreenHistogram.getWidth(); //Get values for each color component from source image. double[] sourceRedValues = ImageProcessing.extractRedColor(Main.getSourceImage()); double[] sourceGreenValues = ImageProcessing.extractGreenColor(Main.getSourceImage()); double[] sourceBlueValues = ImageProcessing.extractBlueColor(Main.getSourceImage()); //Get values for each color component from processed image. double[] processedRedValues = ImageProcessing.extractRedColor(Main.getProcessedImage()); double[] processedGreenValues = ImageProcessing.extractGreenColor(Main.getProcessedImage()); double[] processedBlueValues = ImageProcessing.extractBlueColor(Main.getProcessedImage()); //Create charts for each color component from source image. JFreeChart sourceRedChart = ImageProcessing.createHistogram(sourceRedValues, Color.RED); JFreeChart sourceGreenChart = ImageProcessing.createHistogram(sourceGreenValues, Color.GREEN); JFreeChart sourceBlueChart = ImageProcessing.createHistogram(sourceBlueValues, Color.BLUE); //Create charts for each color component from processed image. JFreeChart processedRedChart = ImageProcessing.createHistogram(processedRedValues, Color.RED); JFreeChart processedGreenChart = ImageProcessing.createHistogram(processedGreenValues, Color.GREEN); JFreeChart processedBlueChart = ImageProcessing.createHistogram(processedBlueValues, Color.BLUE); //Convert each source image charts to a BufferedImage. BufferedImage sourceRedChartImage = sourceRedChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage sourceGreenChartImage = sourceGreenChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage sourceBlueChartImage = sourceBlueChart.createBufferedImage(chartLabelWidth, chartLabelHeight); //Convert each processsed image charts to a BufferedImage. BufferedImage processedRedChartImage = processedRedChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage processedGreenChartImage = processedGreenChart.createBufferedImage(chartLabelWidth, chartLabelHeight); BufferedImage processedBlueChartImage = processedBlueChart.createBufferedImage(chartLabelWidth, chartLabelHeight); //Display each source image charts to GUI. sourceImageRedHistogram.setIcon(new ImageIcon(sourceRedChartImage)); sourceImageGreenHistogram.setIcon(new ImageIcon(sourceGreenChartImage)); sourceImageBlueHistogram.setIcon(new ImageIcon(sourceBlueChartImage)); //Display each source image charts to GUI. processedImageRedHistogram.setIcon(new ImageIcon(processedRedChartImage)); processedImageGreenHistogram.setIcon(new ImageIcon(processedGreenChartImage)); processedImageBlueHistogram.setIcon(new ImageIcon(processedBlueChartImage)); }
From source file:pe.egcc.eureka.app.view.RepoResumen.java
private Object crearImagen(List<Map<String, ?>> lista) { //datos del grfico String moneda = null;//w w w. j a v a2 s. c om DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (Map<String, ?> map : lista) { double importe = Double.parseDouble(map.get("IMPORTE").toString()); moneda = map.get("MONENOMBRE").toString(); String accion = map.get("ACCION").toString(); dataset.addValue(importe, moneda, accion); } JFreeChart graficoBarras = ChartFactory.createBarChart("RESUMEN DE MOVIMIENTOS", //Ttulo de la grfica "TIPOS DE MOVIMIENTOS", //leyenda Eje horizontal "MILES DE " + moneda, //leyenda Eje vertical dataset, //datos PlotOrientation.VERTICAL, //orientacin true, //incluir leyendas true, //mostrar tooltips true); graficoBarras.setBackgroundPaint(Color.LIGHT_GRAY); CategoryPlot plot = (CategoryPlot) graficoBarras.getPlot(); plot.setBackgroundPaint(Color.CYAN); //fondo del grafico plot.setDomainGridlinesVisible(true);//lineas de rangos, visibles plot.setRangeGridlinePaint(Color.BLACK);//color de las lineas de rangos // Crear imagen BufferedImage imagen = graficoBarras.createBufferedImage(500, 300); return imagen; }
From source file:org.squale.squaleweb.applicationlayer.action.results.application.ApplicationResultsAction.java
/** * Action exportPDF pour StyleReport ou iText * /*from w ww . j a v a2 s . co m*/ * @param mapping le actionMapping * @param form le form * @param request la request * @param response la response * @return l'actionForward * @throws ServletException exception pouvant etre levee */ public ActionForward exportPDF(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws ServletException { Collection results = TableUtil.getSortedTable(request.getSession(), "resultListForm", "list"); try { HashMap parameters = new HashMap(); PDFDataJasperReports data = new PDFDataJasperReports(request.getLocale(), getResources(request), results, "/org/squale/squaleweb/resources/jasperreport/ApplicationResults.jasper", false, parameters); // Pour rcuprer les paramtres root parameters.put("applicationName", ((ResultListForm) form).getApplicationName()); // La date ou le nom des audits parameters.put("auditDate", ((ResultListForm) form).getAuditName()); parameters.put("previousAuditDate", ((ResultListForm) form).getPreviousAuditName()); // L'image du pieChart parameters.put("pieChart", (java.awt.Image) request.getSession().getAttribute("pieChart")); // Rcupration des donnes sur la volumtrie des projets de l'application // Prparation de l'appel la couche mtier IApplicationComponent ac = AccessDelegateHelper.getInstance("Graph"); Long pCurrentAuditId = new Long(Long.parseLong(((ResultListForm) form).getCurrentAuditId())); Object[] paramAuditId = { pCurrentAuditId }; // Recherche des donnes PieChart JFreeChart pieChart; Object[] maps = (Object[]) ac.execute("getApplicationPieChartGraph", paramAuditId); // On rcupre la volumtrie par grille final int indexVol = 2; PieChartMaker pieMaker = new PieChartMaker(null, null, null); pieMaker.setValues((Map) maps[indexVol]); pieChart = pieMaker.getChart(new HashMap(), request); // L'image du pieChart pour la volumetrie par grille parameters.put("gridPieChart", pieChart.createBufferedImage(PieChartMaker.DEFAULT_WIDTH, PieChartMaker.DEFAULT_HEIGHT)); // L'image du kiviat parameters.put("kiviatChart", (java.awt.Image) request.getSession().getAttribute("kiviatChart")); // Le // nom // de // l'utilisateur LogonBean logon = (LogonBean) request.getSession().getAttribute(WConstants.USER_KEY); parameters.put("userName", logon.getMatricule()); PDFFactory.generatePDFToHTTPResponse(data, response, "", PDFEngine.JASPERREPORTS); } catch (Exception e) { throw new ServletException(e); } return null; }
From source file:at.ac.tuwien.dsg.utility.DesignChart.java
public void chart(LinkedList<String> xValue, LinkedList<String> yValue) throws Exception { XYSeries series = new XYSeries("Sensory Data"); final JFreeChart chart; //data assignment in the chart {/*from ww w. j av a 2 s. c om*/ for (int i = 0; i < xValue.size(); i++) { series.add(Double.parseDouble(xValue.get(i)), Double.parseDouble(yValue.get(i))); } final XYSeriesCollection data = new XYSeriesCollection(series); chart = ChartFactory.createXYLineChart("Graph Visualization", "collection_time", "collection_data", data, PlotOrientation.VERTICAL, true, true, false); } //design the plot of the chart { XYPlot xyPlot = chart.getXYPlot(); NumberAxis xAxis = (NumberAxis) xyPlot.getDomainAxis(); NumberAxis yAxis = (NumberAxis) xyPlot.getRangeAxis(); xAxis.setRange(20, 120); xAxis.setTickUnit(new NumberTickUnit(15)); yAxis.setRange(947, 950); yAxis.setTickUnit(new NumberTickUnit(0.5)); } //generation of the image { try { BufferedImage img = chart.createBufferedImage(300, 200); //File outputfile = new File("./example/Sample.png"); File outputfile = new File( "/Users/dsg/Documents/phd/Big Demo/CloudLyra/Utils/JBPMEngine/example/Sample.png"); ImageIO.write(img, "png", outputfile); } catch (Exception e) { System.out.println("exception occured in tomcat: " + e); } } }
From source file:org.oscarehr.web.reports.ocan.NeedRatingOverTimeReportGenerator.java
public void generateReport(OutputStream os) throws Exception { Document d = new Document(PageSize.A4.rotate()); d.setMargins(20, 20, 20, 20);//from www .j a v a 2s . co m PdfWriter writer = PdfWriter.getInstance(d, os); writer.setStrictImageSequence(true); d.open(); //header Paragraph p = new Paragraph("Needs Over Time (Consumer and Staff)", titleFont); p.setAlignment(Element.ALIGN_CENTER); d.add(p); d.add(Chunk.NEWLINE); //purpose Paragraph purpose = new Paragraph(); purpose.add(new Chunk("Purpose of Report:", boldText)); purpose.add(new Phrase( "The purpose of this report is to show change over time in a specific Need Rating for an individual Consumer. It adds up the number of needs across all Domains grouped by Need Rating (e.g. Unmet Needs, Met Needs, No Needs, Unknown) for all selected OCANs that were conducted with the Consumer and displays the results in an individual need rating line graph. Each line graph that is displayed compares the Consumer and the Staff's perspective. The staff may share this report with their Consumer as well.", normalText)); d.add(purpose); d.add(Chunk.NEWLINE); //report parameters PdfPTable table = new PdfPTable(2); table.setWidthPercentage(100); table.getDefaultCell().setBorder(0); table.addCell( makeCell(createFieldNameAndValuePhrase("Consumer Name:", getConsumerName()), Element.ALIGN_LEFT)); table.addCell(makeCell(createFieldNameAndValuePhrase("Report Date:", dateFormatter.format(getReportDate())), Element.ALIGN_RIGHT)); table.addCell(makeCell(createFieldNameAndValuePhrase("Staff Name:", getStaffName()), Element.ALIGN_LEFT)); table.addCell(""); d.add(table); d.add(Chunk.NEWLINE); //loop here...groups of 3 int loopNo = 1; List<OcanNeedRatingOverTimeSummaryOfNeedsBean> summaryBeanList = new ArrayList<OcanNeedRatingOverTimeSummaryOfNeedsBean>(); summaryBeanList.addAll(this.summaryOfNeedsBeanList); while (true) { if (summaryBeanList.size() == 0) { break; } List<OcanNeedRatingOverTimeSummaryOfNeedsBean> currentBeanList = new ArrayList<OcanNeedRatingOverTimeSummaryOfNeedsBean>(); for (int x = 0; x < 3; x++) { if (summaryBeanList.size() == 0) { break; } currentBeanList.add(summaryBeanList.remove(0)); } //summary of needs PdfPTable summaryOfNeedsTable = null; if (currentBeanList.size() == 1) { summaryOfNeedsTable = new PdfPTable(3); summaryOfNeedsTable.setWidthPercentage(100f - 52.8f); summaryOfNeedsTable.setWidths(new float[] { 0.26f, 0.12f, 0.12f }); } if (currentBeanList.size() == 2) { summaryOfNeedsTable = new PdfPTable(6); summaryOfNeedsTable.setWidthPercentage(100f - 26.4f); summaryOfNeedsTable.setWidths(new float[] { 0.26f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f }); } if (currentBeanList.size() == 3) { summaryOfNeedsTable = new PdfPTable(9); summaryOfNeedsTable.setWidthPercentage(100f); summaryOfNeedsTable .setWidths(new float[] { 0.26f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f }); } summaryOfNeedsTable.setHorizontalAlignment(Element.ALIGN_LEFT); summaryOfNeedsTable.setHeaderRows(3); addSummaryOfNeedsHeader(summaryOfNeedsTable, currentBeanList, loopNo); addSummaryOfNeedsRow(summaryOfNeedsTable, "Unmet Needs", "unmet", currentBeanList); addSummaryOfNeedsRow(summaryOfNeedsTable, "Met Needs", "met", currentBeanList); addSummaryOfNeedsRow(summaryOfNeedsTable, "No Needs", "no", currentBeanList); addSummaryOfNeedsRow(summaryOfNeedsTable, "Unknown Needs", "unknown", currentBeanList); d.add(summaryOfNeedsTable); d.add(Chunk.NEWLINE); if (summaryBeanList.size() == 0) { break; } loopNo++; } //BREAKDOWN OF SUMMARY OF NEEDS //loop here...groups of 3 loopNo = 1; List<OcanNeedRatingOverTimeNeedBreakdownBean> breakdownBeanList = new ArrayList<OcanNeedRatingOverTimeNeedBreakdownBean>(); breakdownBeanList.addAll(this.needBreakdownListByOCAN); OcanNeedRatingOverTimeNeedBreakdownBean lastBreakDownBean = null; while (true) { if (breakdownBeanList.size() == 0) { break; } List<OcanNeedRatingOverTimeNeedBreakdownBean> currentBeanList = new ArrayList<OcanNeedRatingOverTimeNeedBreakdownBean>(); for (int x = 0; x < 3; x++) { if (breakdownBeanList.size() == 0) { break; } currentBeanList.add(breakdownBeanList.remove(0)); } //summary of needs PdfPTable summaryOfNeedsTable = null; if (currentBeanList.size() == 1) { if (lastBreakDownBean == null) { summaryOfNeedsTable = new PdfPTable(3); summaryOfNeedsTable.setWidthPercentage(100f - 52.8f); summaryOfNeedsTable.setWidths(new float[] { 0.26f, 0.12f, 0.12f }); } else { summaryOfNeedsTable = new PdfPTable(4); summaryOfNeedsTable.setWidthPercentage(100f - 52.8f); summaryOfNeedsTable.setWidths(new float[] { 0.26f - 0.024f, 0.024f, 0.12f, 0.12f }); } } if (currentBeanList.size() == 2) { if (lastBreakDownBean == null) { summaryOfNeedsTable = new PdfPTable(6); summaryOfNeedsTable.setWidthPercentage(100f - 26.4f); summaryOfNeedsTable.setWidths(new float[] { 0.26f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f }); } else { summaryOfNeedsTable = new PdfPTable(7); summaryOfNeedsTable.setWidthPercentage(100f - 26.4f); summaryOfNeedsTable .setWidths(new float[] { 0.26f - 0.024f, 0.024f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f }); } } if (currentBeanList.size() == 3) { if (lastBreakDownBean == null) { summaryOfNeedsTable = new PdfPTable(9); summaryOfNeedsTable.setWidthPercentage(100f); summaryOfNeedsTable.setWidths( new float[] { 0.26f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f }); } else { summaryOfNeedsTable = new PdfPTable(10); summaryOfNeedsTable.setWidthPercentage(100f); summaryOfNeedsTable.setWidths(new float[] { 0.26f - 0.024f, 0.024f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f, 0.024f, 0.12f, 0.12f }); } } summaryOfNeedsTable.setHorizontalAlignment(Element.ALIGN_LEFT); addSummaryOfNeedsDomainHeader(summaryOfNeedsTable, currentBeanList, loopNo); for (int x = 0; x < domains.size(); x++) { addSummaryOfNeedsDomainRow(summaryOfNeedsTable, x, getDomains(), currentBeanList, lastBreakDownBean); } d.add(summaryOfNeedsTable); d.add(Chunk.NEWLINE); if (breakdownBeanList.size() == 0) { break; } if (currentBeanList.size() == 3) { lastBreakDownBean = currentBeanList.get(2); } loopNo++; } JFreeChart chart = generateNeedsOverTimeChart(); BufferedImage image = chart.createBufferedImage((int) PageSize.A4.rotate().getWidth() - 40, 350); Image image2 = Image.getInstance(image, null); d.add(image2); d.close(); }