Jump to content
We've recently updated our Privacy Statement, available here ×

umme

Members
  • Posts

    5
  • Joined

  • Last visited

umme's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Hey! Lucian, Thanx for your answer and cooperation. I've solved my problem. It was about ireport plugin for netbeans. After I reinstall my IDE and set ireport pluging environment again, I found my programs running without error including piechart. regards Umme.
  2. Thanx again. NO, I can't see my chart in jasper viewer. The portion of where the pie chart to be shown is blank. I can upload that pdf file but the chartcontent is not there, only the tabular report part is containing there. I've test it only for pie chart not include the tabular part. And this time no pdf file has created showing no errors. If I use :[ ChartFrame frame = new ChartFrame("EmployeeChart", chart); frame.pack(); frame.setVisible(true); ]instead of createing image.. then I found my desired piechirt as output. pls help me. Post Edited by umme at 01/20/2010 06:28 Post Edited by umme at 01/20/2010 06:34
  3. Thanks for your reply. The Code for image report element in .jrxml's in summary portion is:- ----------------------------------------- <summary> <band height="715"> <image scaleImage="RetainShape" hAlign="Center" vAlign="Middle" isUsingCache="false" evaluationTime="Page"> <reportElement key="element-41" mode="Opaque" x="0" y="33" width="514" height="252" forecolor="#000000" backcolor="#FFFFFF"> <property name="net.sf.jasperreports.export.pdf.tag.table" value="full"/> </reportElement> <graphicElement fill="Solid"> <pen lineWidth="1.0" lineStyle="Solid"/> </graphicElement> <imageExpression class="java.awt.Image"><![CDATA[$P{employeeChart}]]></imageExpression> </image> <staticText> <reportElement key="element-64" mode="Opaque" x="121" y="10" width="293" height="23" forecolor="#000000" backcolor="#FFFFFF"/> <textElement textAlignment="Center" verticalAlignment="Top" rotation="None" lineSpacing="Single"> <font fontName="Arial" size="18" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="true"/> </textElement> <text><![CDATA[Employee Chart]]></text> </staticText> </band> </summary> -------------------------------------------------------- If I use to display piechart as [ ChartFrame frame = new ChartFrame("EmployeeChart", chart); frame.pack(); frame.setVisible(true); ] then the piechart is displays individualy. Else it doesn't shows any reflaction. ----------------------------------------------------------------- The report destination pdf file... path: D:\Drive D\netbeans\iReport\JasperReportSmartQ\reports A pdf file created only with tabular part but there is no image. I herewith attached my employee.jrxml file. Please help me.
  4. Hello all, I'm new in ireport and try to make my first report to display piechart using servlet. I'm using netbeans 6.1 and ireport 3.7.0. I can display a simple tabular report but can't a piechart as pdf output. There is not any warnings or errors to catch my implementation problems. Pls. help me with this.... Code:EmployeeServlet.java:protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); EmployeeReport employeeReport = new EmployeeReport(); try { String servletPath = getServletContext().getRealPath("/"); String reportSource =servletPath + "template/employee.jrxml"; String reportDestPDF =servletPath + "reports/EmployeeReport.pdf"; params.put("reportTitle", "Hello Report World"); params.put("author", "Umme Habiba"); params.put("startDate", (new java.util.Date()).toString()); params.put("employeeChart", employeeReport.createEmployeeChartImage()); jasperDesign = JRXmlLoader.load(reportSource); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); Connection conn; conn = dbConnection.getConnection(); JasperPrint jasperPrint =JasperFillManager.fillReport(jasperReport, params, conn); JasperExportManager.exportReportToPdfFile(jasperPrint, reportDestPDF); ServletOutputStream servletOutputStream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, servletOutputStream); JasperViewer.viewReport(jasperPrint); response.setContentType("application/pdf"); servletOutputStream.flush(); servletOutputStream.close(); } catch (JRException ex) { Logger.getLogger(EmployeeSevlet.class.getName()).log(Level.SEVERE, null, ex); } } ------------------------------createEmployeeChartImage():------------------------------public java.awt.Image createEmployeeChartImage(){ java.util.Hashtable employeeData = getEmployeeData(); DefaultPieDataset data = new DefaultPieDataset(); for(java.util.Enumeration e = employeeData.keys(); e.hasMoreElements();){ String employeeName = (String)e.nextElement(); System.out.println("dataset key element... " + employeeName); data.setValue(employeeName, (Double)employeeData.get(employeeName)); } JFreeChart chart = ChartFactory.createPieChart("Employee Chart", data, true, true, true); return chart.createBufferedImage(500, 220); }
  5. Hello, I'm building a simple report using ireport 3.7.0. I tried to set a pie chart using servlet in a pdf file. Also there is a simple tabular report part in detail tag. And the image in summary part. The report runs with the tabular part but blank shows in image part. But there is no error shown. The code is given below... EmployeeSevlet.java: public class EmployeeSevlet extends HttpServlet { Map<String, Object> params = new HashMap<String, Object>(); DBConnection dbConnection = new DBConnection(); private JasperDesign jasperDesign; protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); EmployeeReport employeeReport = new EmployeeReport(); try { String servletPath = getServletContext().getRealPath("/"); String reportSource =servletPath + "template/employee.jrxml"; String reportDestPDF =servletPath + "reports/EmployeeReport.pdf"; params.put("reportTitle", "Hello Report World"); params.put("author", "Umme Habiba"); params.put("startDate", (new java.util.Date()).toString()); params.put("employeeChart", employeeReport.createEmployeeChartImage()); jasperDesign = JRXmlLoader.load(reportSource); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); Connection conn; conn = dbConnection.getConnection(); JasperPrint jasperPrint =JasperFillManager.fillReport(jasperReport, params, conn); jasperExportManager.exportReportToPdfFile(jasperPrint, reportDestPDF); ServletOutputStream servletOutputStream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(jasperPrint, servletOutputStream); JasperViewer.viewReport(jasperPrint); response.setContentType("application/pdf"); servletOutputStream.flush(); servletOutputStream.close(); } catch (JRException ex) {............. ....................createEmployeeChartImage():- public java.awt.Image createEmployeeChartImage(){ java.util.Hashtable employeeData = getEmployeeData(); DefaultPieDataset data = new DefaultPieDataset(); for(java.util.Enumeration e = employeeData.keys(); e.hasMoreElements();){ String employeeName = (String)e.nextElement(); data.setValue(employeeName, (Double)employeeData.get(employeeName)); } JFreeChart chart = ChartFactory.createPieChart("Employee Chart", data, true, true, true); return chart.createBufferedImage(500, 220); } .......................................................... Pls, help me with this.
×
×
  • Create New...