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

Infinite loop when I generate multiple charts in the same report with JasperStudio 6.6.0.final in Eclipse


fr.fucci

Recommended Posts

I need to generate multiple charts in a report given a `List<List<ChartBean<Double,Double>>`
which is populated with the data I get from a file.

ChartBean is declared as follows:

 

public class ChartBean<T,U> {        T xCoordinate;        U yCoordinate;        String series;                public ChartBean(T x,U y,String series) {            this.xCoordinate = x;            this.yCoordinate = y;            this.series = series;        }                public void setxCoordinate(T x) {            this.xCoordinate = x;        }                public void setyCoordinate(U y) {            this.yCoordinate = y;        }                public T getxCoordinate() {            return xCoordinate;        }                public U getyCoordinate() {            return yCoordinate;        }                public String setseries() {            return series;        }                public String getseries() {            return series;         }    }[/code]

I pass the parameters to the template generator in the following way
`parameters.put("XYDataSource", values);` , where values contains the list of list of coordinates.

What I get is that my application hangs and does not generate any report. I checked multiple times the content of the XML and it seems in line with what is described in the post. I tried also to generate one chart (without using list of lists) and it works.

I have a top report whose summary band contains a sub report "sub_charts.xml".
In its detail band I put another subreport which contains the line chart and I use the "_THIS" field to pass the `List<ChartBean<Double,Double>`
The content of the subreports is reported here.

sub_charts.jrxml

 <?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="subcharts_2" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="97e07501-37b1-4c04-970b-33f120c8264d">
 <parameter name="REPORT_DIR" class="java.lang.String"/>
<field name="_THIS" class="java.util.List">
<fieldDescription><![CDATA[_THIS]]></fieldDescription>
</field>
<detail>
<band height="359">
 <subreport>
<reportElement x="22" y="25" width="510" height="320" uuid="6ea2325b-969e-472a-9d49-d5c33667fab5"/>
<dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{_THIS})]]></dataSourceExpression>
 <subreportExpression><![CDATA[$P{REPORT_DIR}+"/sub_chart.jasper"]]></subreportExpression>
</subreport>
 </band>
 </detail>
</jasperReport>

sub_chart.jrxml

    <?xml version="1.0" encoding="UTF-8"?>
    <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="subchart_2" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="6cdd6eb2-73da-4026-823b-574910e37c68">
    <field name="series" class="java.lang.String"/>
    <field name="xCoordinate" class="java.lang.Double"/>
    <field name="yCoordinate" class="java.lang.Double"/>
    <summary>
        <band height="270">
            <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/>
            <xyLineChart>
                <chart evaluationTime="Report">
                    <reportElement isPrintRepeatedValues="false" x="0" y="0" width="555" height="270" uuid="4bfd2379-7617-47fb-9c2a-4eeb0b72eadf"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <xyDataset>
                    <xySeries autoSort="true">
                        <seriesExpression><![CDATA[$F{series}]]></seriesExpression>
                        <xValueExpression><![CDATA[$F{xCoordinate}]]></xValueExpression>
                        <yValueExpression><![CDATA[$F{yCoordinate}]]></yValueExpression>
                    </xySeries>
                </xyDataset>
                <linePlot>
                    <plot/>
                    <categoryAxisFormat>
                        <axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
                    </valueAxisFormat>
                </linePlot>
            </xyLineChart>
        </band>
    </summary>
</jasperReport>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...