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

meha4692

Members
  • Posts

    8
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Security Advisories

Downloads

Posts posted by meha4692

  1. Hey, did you get a solution to this? I am having the same problem. I am trying to use the new JRRtfExporter.java file in v 1.3.0 of JasperReports. It hogs up my memory while creating the RTF because it is trying to generate really big images with really good resolution. If there was some way to just generate the RTF reports that are reasonably clear (not too blurry nor with the greatest resolution) so that the file size is not huge, that would be great.

    I also have another question for you. When you were fixing the compile errors in the JRRtfExporter file, did you get errors for these methods below and the 'defaultFont' variable not being found? Where are these coming from?

    Code:
    getDefaultFont();
    getFontIndex(defaultFont);

    My labels in my chart images are not being displayed probably because I commented these lines out to get rid of compilation errors.

     

    Any help is greatly appreciated. Thanks!

  2. Hi,

     

    I have a report with a couple of charts. I use iReport to export them in different formats like PDF, RTF and HTML. The charts look great in PDF format but comes out to be blurry when I export to HTML and Word. I use a scriptlet to create the charts. I create JFreeChart objects and populate a JRRenderable object with the JFreeChart objects through a the scriptlet. This is an example of what I do for one of the charts:

    1. create an image of type net.sf.jasperreports.engine.JRRenderable in the jrxml to act as placeholders for each chart, create a variable for each chart and assign these variable values that to the image.

    2. create a scriptlet that populates these variables in the jrxml:

    Code:
    JFreeChart chart = createChart(dataset);
    this.setVariableValue("myChartVar", new JCommonDrawableRenderer(chart));

    //create the chart
    public JFreeChart createChart(DefaultCategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart3D("", "", "Percent", dataset, PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint(Color.white);
    //set the border properties of the bars
    chart.setBorderPaint(Color.black);
    chart.setBorderStroke(new BasicStroke(1));

    CategoryPlot plot = (CategoryPlot)chart.getPlot();
    CategoryItemRenderer renderer = new CustomRenderer(new Paint[] {new Color(74,169,205), Color.yellow,
    new Color(149,45,108), new Color(51,54,171), new Color(60,117,245), new Color(208,23,23), new Color(74,169,205)}
    );

    ItemLabelPosition pos = new ItemLabelPosition(ItemLabelAnchor.CENTER ,
    TextAnchor.CENTER, TextAnchor.CENTER, 45.0
    );

    renderer.setPositiveItemLabelPosition(pos);
    plot.setRenderer(renderer);
    plot.getRangeAxis().setLabelFont(mediumLabelFont);
    plot.getRangeAxis().setTickLabelFont(smallLabelFont);
    plot.getDomainAxis().setTickLabelFont(smallLabelFont);

    return chart;
    }

     

    I found out that by default the JCommonDrawableRenderer images are in PNG format. Would this have anything to do with the bad quality of images in Word and HTML formats? If so, how would I go about changing the format to JPEG or anything else? There doesn't seem to be any easy way of doing it. I need these chart images to look clear in ALL 3 formats somehow. Any help would be greatly appreciated.

     

    Thanks!

×
×
  • Create New...