US and Worldwide: +1 (866) 660-7555
Results 1 to 4 of 4

Thread: export of report with jFreeChart

  1. #1
    Join Date
    Mar 2003
    Posts
    4,947

    Default export of report with jFreeChart

    Hi!
    I have defined JFreeChart as a drawable-field in my xml report definition.
    The problem occurs when I try to:
    1. print report;
    the following exception is caught :

    ERROR: On CloseLogicalPage
    java.lang.IllegalArgumentException: Zero length string passed to TextLayout constructor.
    at java.awt.font.TextLayout.<init>(TextLayout.java:471)
    at sun.java2d.pipe.OutlineTextRenderer.drawString(OutlineTextRenderer.java:67)
    at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:32)
    at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2613)
    at sun.print.ProxyGraphics2D.drawString(ProxyGraphics2D.java:1326)
    at org.jfree.chart.TextTitle.drawHorizontal(Unknown Source)
    at org.jfree.chart.TextTitle.draw(Unknown Source)
    at org.jfree.chart.JFreeChart.drawTitle(Unknown Source)
    at org.jfree.chart.JFreeChart.draw(Unknown Source)
    at org.jfree.chart.JFreeChart.draw(Unknown Source)
    at org.jfree.report.modules.output.pageable.graphics.G2OutputTarget.drawDrawable(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.operations.PhysicalOperation$ProcessDrawableOperation.performOperation(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.physicals.PhysicalPage.write(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.physicals.LogicalPageImpl.close(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.AlignedLogicalPageWrapper.close(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.pagelayout.PageLayouter.endPage(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.pagelayout.SimplePageLayouter.endPage(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.pagelayout.SimplePageLayouter.doPrint(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.pagelayout.SimplePageLayouter.print(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.pagelayout.SimplePageLayouter.printBand(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.pagelayout.SimplePageLayouter.itemsAdvanced(Unknown Source)
    at org.jfree.report.function.LevelledExpressionList.itemsAdvanced(Unknown Source)
    at org.jfree.report.states.ReportState.fireItemsAdvancedEvent(Unknown Source)
    at org.jfree.report.states.InItemGroupState.advance(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.PageableReportProcessor.processPage(Unknown Source)
    at org.jfree.report.modules.output.pageable.base.PageableReportProcessor.processPage(Unknown Source)
    at org.jfree.report.modules.gui.base.ReportPane.print(Unknown Source)
    at sun.print.RasterPrinterJob.printPage(RasterPrinterJob.java:1621)
    at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:1078)
    at sun.print.RasterPrinterJob.print(RasterPrinterJob.java:979)
    at org.jfree.report.modules.gui.print.PrintExportTask.run(Unknown Source)
    at org.jfree.report.util.Worker.run(Unknown Source)

    Please, can you tell me what should be wrong in my implmentation? (When I remove JFreeChart from the report, prining is OK)

    2.export to pdf file.
    In the created pdf file chart is not located on the defined place. Is it known jfreereport bug or my wrong settings???

    Thanks

  2. #2
    Join Date
    Mar 2003
    Posts
    7,989

    Default

    Hi,

    to the first exception:

    As we do no processing of the content, JFreeReport is not responsible for that exception. In its current state, JFR has no notion of JFreeChart as such, all we see is a org.jfree.ui.Drawable object which should be drawn at the given bounds by calling:

    Drawable.draw(..)

    Please check your chart definition; could it be that your chart's title is empty? (purely guessing from the given exception).

    To 2: To me no such bug is known, but that doesn't mean anything How do you define your elements and what exactly means "not at the defined place"?

    Have more fun,
    said Thomas

  3. #3

    Default

    The exception is caused by a bug in JFreeChart when the chart title is an empty string. I've added an entry in the bug database at SourceForge:

    http://sourceforge.net/tracker/index...94&atid=115494

    This should be easy to fix, so hopefully the 0.9.14 release will include the fix.
    Dave Gilbert
    JFreeChart Project Leader

    :idea: Buy the JFreeChart Developer Guide :idea:
    :!: Did I help you? Help someone else : WaterAid :!:

  4. #4
    Join Date
    Mar 2003
    Posts
    4,947

    Default

    1. JFreeChart exception during printing:
    I have solved this problem substituting "" as title parameter by " ". Now it works. Thanks for help.

    2. export to pdf:
    How do you define your elements and what exactly means "not at the defined place"?
    Here is definition of the elements:
    Code:
    <element type="drawable/generic">
                  <style>
                    <compound-key name="absolute_pos">
                      <basic-object name="x">20.0</basic-object>
                      <basic-object name="y">80.0</basic-object>
                    </compound-key>
                    <compound-key name="min-size">
                      <basic-object name="height">300</basic-object>
                      <basic-object name="width">400</basic-object>
                    </compound-key>
                    <basic-key name="alignment">center</basic-key>
                  </style>
                  <datasource type="DrawableFilter">
                     <datasource type="DataRowDataSource">
                        <basic-object name="dataSourceColumnName">chart</basic-object>
                     </datasource>
                  </datasource>
               </element>
    This element is defined in the report header and in the preview it is displayed at the correct place. In the pdf document this element is displayed in left bottom corner as a background of table itmes. It is interesting but not what we require.
    The same behaviour of location drawable-field in the pdf file I have noiced also in your demo application :!: ('Shape and drawable' report). Please, look at it what is wrong.
    Thanks
    Fero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •