我正在使用 iReport 来显示包含6个不同字段的饼图。我使用 3.1.4 ,因为它与 Bizflow Advreport 兼容。在 iReport 3.1.4 中预览图表时,饼图/图例/标题都会正确显示。但是,当我将它放在网站上时,它只显示标题。将文件带入 5.0.1 没有任何显示,就像在网站上一样。
我试图弄乱边缘和乐队的大小,但我似乎无法正确显示饼图。
我还附上了我从 3.1.4 收到的两个不同的预览:
和另一个来自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>
有谁知道可能导致此问题的原因。如果需要,我也可以提供文件。
答案 0 :(得分: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>