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

njrfrens

Members
  • Posts

    17
  • Joined

  • Last visited

njrfrens's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Got it... Its quite simple... Just wrote below code in customize method of the Chart Customizer class and it worked :-) Code:GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer();KeyToGroupMap map = new KeyToGroupMap("G1");map.mapKeyToGroup("Facility 1(ONE)", "G1");map.mapKeyToGroup("Facility 2(ONE)", "G1");map.mapKeyToGroup("Facility 3(ONE)", "G1");map.mapKeyToGroup("Facility 4(ONE)", "G1");map.mapKeyToGroup("Facility 1(ALL)", "G2");map.mapKeyToGroup("Facility 2(ALL)", "G2");map.mapKeyToGroup("Facility 3(ALL)", "G2");map.mapKeyToGroup("Facility 4(ALL)", "G2");renderer.setSeriesToGroupMap(map); CategoryPlot plot = (CategoryPlot) chart.getPlot();plot.setRenderer(renderer); Post Edited by janardan n at 04/08/09 08:31
  2. Can please provide more information how to achieve the same by chart customizer? any pointers where I can refer for the same...?
  3. below is the code to display GroupedStacked Bar chart using JFreeChart Code:public void generateStackedChart(OutputStream out, Object data) { try { JFreeChart chart = ChartFactory.createStackedBarChart( "Alerts as % of Total Programs", "Alerts", "%", getStackedDataSet(), PlotOrientation.VERTICAL, true, // include legend false, // tooltips false); // urls GroupedStackedBarRenderer renderer = new GroupedStackedBarRenderer(); KeyToGroupMap map = new KeyToGroupMap("G1"); map.mapKeyToGroup("Facility 1(ONE)", "G1"); map.mapKeyToGroup("Facility 2(ONE)", "G1"); map.mapKeyToGroup("Facility 3(ONE)", "G1"); map.mapKeyToGroup("Facility 4(ONE)", "G1"); map.mapKeyToGroup("Facility 1(ALL)", "G2"); map.mapKeyToGroup("Facility 2(ALL)", "G2"); map.mapKeyToGroup("Facility 3(ALL)", "G2"); map.mapKeyToGroup("Facility 4(ALL)", "G2"); renderer.setSeriesToGroupMap(map); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRenderer(renderer); BufferedImage buffImg = chart.createBufferedImage(500, // width 375, // height BufferedImage.TYPE_INT_RGB, // image type null); ImageIO.write(buffImg, "jpeg", out); } catch (IOException e) { e.printStackTrace(); }}private DefaultCategoryDataset getStackedDataSet() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); // dataset.addValue(1.0, "Row 1", "Column 1"); dataset.addValue(10.0, "Facility 1(ONE)", "Jan 2008"); dataset.addValue(50.0, "Facility 1(ONE)", "Feb 2008"); dataset.addValue(30.0, "Facility 1(ALL)", "Jan 2008"); dataset.addValue(25.0, "Facility 1(ALL)", "Feb 2008"); dataset.addValue(20.0, "Facility 2(ONE)", "Jan 2008"); dataset.addValue(30.0, "Facility 2(ONE)", "Feb 2008"); dataset.addValue(20.0, "Facility 2(ALL)", "Jan 2008"); dataset.addValue(30.0, "Facility 2(ALL)", "Feb 2008"); dataset.addValue(20.0, "Facility 3(ONE)", "Jan 2008"); dataset.addValue(30.0, "Facility 3(ONE)", "Feb 2008"); dataset.addValue(20.0, "Facility 3(ALL)", "Jan 2008"); dataset.addValue(30.0, "Facility 3(ALL)", "Feb 2008"); dataset.addValue(20.0, "Facility 4(ONE)", "Jan 2008"); dataset.addValue(30.0, "Facility 4(ONE)", "Feb 2008"); dataset.addValue(20.0, "Facility 4(ALL)", "Jan 2008"); dataset.addValue(20.0, "Facility 4(ALL)", "Feb 2008"); return dataset;}
  4. Hi Can any one please inform me if there is any solution for it...? At least can please inform me whether this is feasible or not?
  5. Hi Can any one please inform me if there is any solution for it...? At least please inform me whether this is feasible or not?
  6. Hi Can any one please inform me if there is any solution for it...? At least please inform me whether this is feasible or not?
  7. Hi Can any one please inform me if there is any solution for it...? At least please inform me whether this is feasible or not?
  8. Can any one please inform if there is any solution for it...?
  9. I'm displaying a bar chart in my jasper report. In the chart, I'm customizing the tooltips with my own expression for each group. When I view the report in the JRViewer through IReport, I could see the tooltips properly. I'm exporting this report as an image and showing it in my webpage using JRGraphics2DExporter. That time, I couldn't see the tooltips. Below is the code I'm using for exporting the chart as image... Code:JasperPrint jasperPrint = getJasperPrint();JRGraphics2DExporter exporter = new JRGraphics2DExporter();exporter.setParameter (JRExporterParameter.JASPER_PRINT, jasperPrint);exporter.setParameter (JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics ()); Map imagesMap = new HashMap();HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);session.setAttribute("IMAGES_MAP", imagesMap);exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.FALSE);exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, FacesContext.getCurrentInstance().getExternalContext()+"/images?image=");exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(0));exporter.exportReport ();
  10. I'm generating a bar chart using Jasper Reports. I'm showing that chart as an image in the JSP file. There is a click button on the Jsp Page. On click of button, the data used for graph should be exported as a CSV File. I'm using below code to export to CSV. but it is not exporting the data. Just creating the file with zero bytes. Code:JasperPrint jasperPrintJRCsvExporter csvExporter = new JRCsvExporter();csvExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);csvExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,"xyz.csv");csvExporter.exportReport();
  11. Can any one inform me how to implement grouping while implementing StackedBar Chart using Jasper Reports... Attached is the Sample Chart to be developed. It can be done in JFreeChart by using GroupedStackedBarRenderer. But I want to know how to do the same in Jasper Reports...
  12. Can any one inform me how to implement grouping while implementing StackedBar Chart using Jasper Reports... Attached is the Sample Chart to be developed. It can be done in JFreeChart by using GroupedStackedBarRenderer. But I want to know how to do the same in Jasper Reports...
  13. Can any one inform me how to implement grouping while implementing StackedBar Chart using Jasper Reports... Attached is the Sample Chart to be developed. It can be done in JFreeChart by using GroupedStackedBarRenderer. But I want to know how to do the same in Jasper Reports...
  14. I'm in need of a report, where I need to display a stacked bar chart along with grouping of items like in the attached image file. JFreeChart can do this by using GroupedStackedBarRenderer. Below is the link where it has the description http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/renderer/category/GroupedStackedBarRenderer.html Now, how can I achieve the same in my jrxml? Post Edited by janardan n at 03/10/09 04:25
  15. I've the requirement of displaying the charts in my web pages(using JSF). While looking at jasper, I found 2 approaches 1. Using JFreeChart and displaying the generated chart as image 2. Using jasper reports, write jrxml and convert to jasper and then to image and then display it in the web page Though, using JFreeChart seems to be the tailor made approach for displaying in web pages, I found second approach to be better because, a. I need not write code for customized display of charts b. For any change in the chart format, I can edit it's jrxml file using iReport IDE Will there be any additional advantages/disadvanages in going with approach 2 instead of one Requesting any suggestions/thoughts on this... Post Edited by janardan n at 03/03/09 13:03
×
×
  • Create New...