jasper报告在JasperSoftStudio中正常工作但在java错误中失败类别系列名称为null

时间:2016-02-15 16:42:06

标签: java charts jasper-reports

标题1#我使用了jasperstudio 6.1.0 Final和jdk1.8.0_45

我的报告应该呈现一个图表,当我用jasperstudio测试它工作正常,但是使用java它不起作用,参数很好地传递给报告但我无法理解这个错误是如何发生的(图表类别系列名称为null)看起来图表在接收数据之前尝试渲染。

有人不能给我一个主意吗?感谢

这是我的代码

        <?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.0.final using JasperReports Library version 6.1.0  -->
<!-- 2016-02-15T17:18:03 -->
<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="commune_comparaison_indicateur_all" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b3073055-44bc-443c-af56-d7b87f076793">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="SISED_DATA_ADAPTER"/>

        <conditionalStyle>
            <conditionExpression>    <![CDATA[new Boolean($V{REPORT_COUNT}.intValue()%2==0)]]>    </conditionExpression>
            <style backcolor="#F2F2F2"/>
        </conditionalStyle>
    </style>
    <parameter name="id_commune_liste" class="java.util.Collection">
        <parameterDescription>    <![CDATA[]]>    </parameterDescription>
    </parameter>
    <parameter name="annee_debut" class="java.lang.String"/>
    <parameter name="annee_fin" class="java.lang.String"/>
    <parameter name="id_indicateur" class="java.lang.String"/>
    <queryString>
        <![CDATA[Select di.id_indicateur, i.libelle AS "libelle_indicateur", di.id_commune,c.code_commune, c.libelle AS "libelle_commune", ac.valeur AS "annee", SUM(CASE WHEN di.valeur_calcule IS NULL THEN 0 ELSE di.valeur_calcule END) AS "valeur_calcule" FROM Annee_Civile ac  
        LEFT OUTER JOIN (donnees_indicateur_commune di      JOIN indicateur i on (di.id_indicateur = i.id_indicateur)
       JOIN commune c on (di.id_commune=c.id_commune) )     ON (ac.valeur=di.Annee AND di.id_indicateur = $P{id_indicateur}  AND  ($X{ IN, di.id_commune,  id_commune_liste})  ) WHERE ac.valeur BETWEEN  $P{annee_debut} AND $P{annee_fin} GROUP BY  di.id_indicateur,i.libelle, ac.valeur, di.id_commune,c.code_commune, c.libelle ORDER BY  ac.valeur]]>

    </queryString>
    <field name="id_indicateur" class="java.lang.String"/>
    <field name="libelle_indicateur" class="java.lang.String"/>
    <field name="id_commune" class="java.lang.String"/>
    <field name="code_commune" class="java.lang.String"/>
    <field name="libelle_commune" class="java.lang.String"/>
    <field name="annee" class="java.lang.String"/>
    <field name="valeur_calcule" class="java.lang.Float"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="100" splitType="Stretch">
            <textField>
                <reportElement x="1" y="0" width="549" height="30" forecolor="#0000CC" uuid="692b5946-c0e3-4f9f-828c-09cfb28cd2ce"/>
                <box>
                    <topPen lineWidth="1.0" lineStyle="Solid" lineColor="#0000CC"/>
                    <leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#0000CC"/>
                    <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#0000CC"/>
                    <rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#0000CC"/>
                </box>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="14" isBold="true" isUnderline="false"/>
                </textElement>
                <textFieldExpression>    <![CDATA["COMPARAISON DE COMMUNES"]]>    </textFieldExpression>
            </textField>
        </band>
    </title>
    <detail>
        <band height="232">
            <printWhenExpression>    <![CDATA[$V{REPORT_COUNT}==1]]>    </printWhenExpression>
            <barChart>
                <chart evaluationTime="Report">
                    <reportElement key="" x="10" y="9" width="548" height="200" uuid="8a37ca8c-9b9f-402f-8429-5760598efff6"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <categoryDataset>
                    <categorySeries>
                        <seriesExpression>    <![CDATA[$F{libelle_commune}]]>    </seriesExpression>
                        <categoryExpression>    <![CDATA[$F{annee}]]>    </categoryExpression>
                        <valueExpression>    <![CDATA[$F{valeur_calcule}]]>    </valueExpression>
                        <labelExpression>    <![CDATA[$F{id_commune}]]>    </labelExpression>
                    </categorySeries>
                </categoryDataset>
                <barPlot>
                    <plot/>
                    <itemLabel/>
                    <categoryAxisFormat>
                        <axisFormat/>
                    </categoryAxisFormat>
                    <valueAxisFormat>
                        <axisFormat/>
                    </valueAxisFormat>
                </barPlot>
            </barChart>
        </band>
    </detail>
    <pageFooter>
        <band height="27" splitType="Stretch"/>
    </pageFooter>
</jasperReport>

0 个答案:

没有答案