0

我正在使用iReport显示一个包含 6 个不同字段的饼图。我使用3.1.4是因为它与Bizflow Advreport兼容。在iReport 3.1.4中预览图表时,饼图/图例/标题都正确显示。但是,当我把它放在网站上时,它只显示标题。将文件带入5.0.1没有任何显示,就像它在网站上所做的一样。

我试图弄乱条带的边距和大小,但我似乎无法正确显示饼图。

我还附上了我从3.1.4收到的两个不同的预览:

3.1.4

另一个来自 5.0.1:

5.0.1

这里还有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="report name" pageWidth="380" pageHeight="300" columnWidth="380" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
    <queryString>
        <![CDATA[Select CapabilityAreaName , SUM(ProjectedDevelopmentCost) as TotalProjectedDevelopmentCost, ROUND(100*SUM(ProjectedDevelopmentCost)/(SELECT SUM(ProjectedDevelopmentCost) FROM RequirementFunding),2)AS percentOfTotal
FROM Requirement
INNER JOIN CapabilityArea
ON Requirement.CapabilityAreaId = CapabilityArea.CapabilityAreaId
INNER JOIN RequirementFunding
ON Requirement.RequirementId = RequirementFunding.RequirementId
GROUP BY CapabilityAreaName]]>
    </queryString>
    <field name="CapabilityAreaName" class="java.lang.String">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="TotalProjectedDevelopmentCost" class="java.lang.Double">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <field name="percentOfTotal" class="java.lang.Double">
        <fieldDescription><![CDATA[]]></fieldDescription>
    </field>
    <background>
        <band/>
    </background>
    <title>
        <band height="50">
            <staticText>
                <reportElement x="0" y="12" width="380" height="25"/>
                <textElement textAlignment="Center">
                    <font size="14" isBold="true"/>
                </textElement>
                <text><![CDATA[Project Development Cost By Capability Area]]></text>
            </staticText>
            <line>
                <reportElement x="0" y="49" width="380" height="1"/>
            </line>
            <line>
                <reportElement x="0" y="0" width="380" height="1"/>
            </line>
        </band>
    </title>
    <columnHeader>
        <band height="250">
            <pieChart>
                <chart hyperlinkType="Reference">
                    <reportElement x="0" y="0" width="380" height="250"/>
                    <chartTitle/>
                    <chartSubtitle/>
                    <chartLegend/>
                </chart>
                <pieDataset>
                    <keyExpression><![CDATA[$F{CapabilityAreaName}]]></keyExpression>
                    <valueExpression><![CDATA[$F{TotalProjectedDevelopmentCost}]]></valueExpression>
                    <labelExpression><![CDATA[$F{percentOfTotal}.toString() + "% - $" + $F{TotalProjectedDevelopmentCost}]]></labelExpression>
                    <sectionHyperlink hyperlinkType="Reference">
                        <hyperlinkReferenceExpression><![CDATA["http://ess-bizflow:8080/bizflowadvreport/flow.html?_flowId=reportTinkerViewReportFlow&reportUnit=/reports/standard_reports/IR_D/AMOD/ActiveRequirementsCostTimeBreakdownTable&&CASelected=" + $F{CapabilityAreaName}]]></hyperlinkReferenceExpression>
                    </sectionHyperlink>
                </pieDataset>
                <piePlot>
                    <plot/>
                </piePlot>
            </pieChart>
        </band>
    </columnHeader>
</jasperReport>

有谁知道可能导致此问题的原因。如果需要,我也可以提供文件。

4

1 回答 1

2

从 XML 看来,您已将饼图放在<columnhearder>带中尝试将图表放在<summary>带中。

<columnHeader>
    <band height="250">
        <pieChart>
            <chart hyperlinkType="Reference">
                <reportElement x="0" y="0" width="380" height="250"/>
                <chartTitle/>
                <chartSubtitle/>
                <chartLegend/>
            </chart>
            <pieDataset>
                <keyExpression><![CDATA[$F{CapabilityAreaName}]]></keyExpression>
                <valueExpression><![CDATA[$F{TotalProjectedDevelopmentCost}]]></valueExpression>
                <labelExpression><![CDATA[$F{percentOfTotal}.toString() + "% - $" + $F{TotalProjectedDevelopmentCost}]]></labelExpression>
                <sectionHyperlink hyperlinkType="Reference">
                    <hyperlinkReferenceExpression><![CDATA["http://ess-bizflow:8080/bizflowadvreport/flow.html?_flowId=reportTinkerViewReportFlow&reportUnit=/reports/standard_reports/IR_D/AMOD/ActiveRequirementsCostTimeBreakdownTable&&CASelected=" + $F{CapabilityAreaName}]]></hyperlinkReferenceExpression>
                </sectionHyperlink>
            </pieDataset>
            <piePlot>
                <plot/>
            </piePlot>
        </pieChart>
    </band>
</columnHeader>

尝试这个:-

      <?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="report name" pageWidth="380" pageHeight="300" columnWidth="380" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<queryString>
    <![CDATA[Select CapabilityAreaName , SUM(ProjectedDevelopmentCost) as  
             TotalProjectedDevelopmentCost, 
             ROUND(100*SUM(ProjectedDevelopmentCost)/(SELECT 
        SUM(ProjectedDevelopmentCost) FROM RequirementFunding),2)AS percentOfTotal
      FROM Requirement
      INNER JOIN CapabilityArea
      ON Requirement.CapabilityAreaId = CapabilityArea.CapabilityAreaI d
      INNER JOIN RequirementFunding
      ON Requirement.RequirementId = RequirementFunding.RequirementId
     GROUP BY CapabilityAreaName]]>
</queryString>
<field name="CapabilityAreaName" class="java.lang.String">
    <fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="TotalProjectedDevelopmentCost" class="java.lang.Double">
    <fieldDescription><![CDATA[]]></fieldDescription>
</field>
<field name="percentOfTotal" class="java.lang.Double">
    <fieldDescription><![CDATA[]]></fieldDescription>
</field>
<background>
    <band/>
</background>
<title>
    <band height="50">
        <staticText>
            <reportElement x="0" y="12" width="380" height="25"/>
            <textElement textAlignment="Center">
                <font size="14" isBold="true"/>
            </textElement>
            <text><![CDATA[Project Development Cost By Capability Area]]></text>
        </staticText>
        <line>
            <reportElement x="0" y="49" width="380" height="1"/>
        </line>
        <line>
            <reportElement x="0" y="0" width="380" height="1"/>
        </line>
    </band>
</title>
<summary>
    <band height="300">
        <pieChart>
            <chart hyperlinkType="Reference">
                <reportElement x="14" y="15" width="348" height="270"/>
                <chartTitle/>
                <chartSubtitle/>
                <chartLegend/>
            </chart>
            <pieDataset>
                <keyExpression><![CDATA[$F{CapabilityAreaName}]]></keyExpression>
                <valueExpression><![CDATA[$F{TotalProjectedDevelopmentCost}]]></valueExpression>
                <labelExpression><![CDATA[$F{percentOfTotal}.toString() + "% - $" + $F{TotalProjectedDevelopmentCost}]]></labelExpression>
                <sectionHyperlink hyperlinkType="Reference">
                    <hyperlinkReferenceExpression><![CDATA["http://ess-bizflow:8080/bizflowadvreport/flow.html?_flowId=reportTinkerViewReportFlow&reportUnit=/reports/standard_reports/IR_D/AMOD/ActiveRequirementsCostTimeBreakdownTable&&CASelected=" + $F{CapabilityAreaName}]]></hyperlinkReferenceExpression>
                </sectionHyperlink>
            </pieDataset>
            <piePlot>
                <plot/>
                <itemLabel/>
            </piePlot>
        </pieChart>
    </band>
</summary>

于 2013-03-26T05:59:00.080 回答