我想在一份报告中制作包含时间序列和交叉表的jasper报告。 下面是我的代码,它正确显示时间序列,但交叉表只显示一半数据。
<?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="report5" pageWidth="590" pageHeight="595" columnWidth="550" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="46"/>
<style name="Crosstab Data Text" hAlign="Center"/>
<parameter name="citizenID" class="java.lang.String"/>
<parameter name="ContactType" class="java.lang.String"/>
<parameter name="bloodGroup" class="java.lang.String"/>
<parameter name="name" class="java.lang.String"/>
<parameter name="MaritalStatus" class="java.lang.String"/>
<parameter name="DOB" class="java.lang.String"/>
<parameter name="citizenPhotoImg" class="java.lang.String"/>
<parameter name="ContactDetails" class="java.lang.String"/>
<parameter name="gender" class="java.lang.String"/>
<parameter name="address" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT tbPatientMeasurement.MeasurementValue, tbPatientMeasurement.Taken, tbMeasurement.MeasurementName, tbPatientMeasurement.MeasurementIDF,
tbUOM.UOMName, tbPatientMeasurement.PatientMeasurementIDP, REPLACE(REPLACE(REPLACE(CONVERT(CHAR(19), CONVERT(DATETIME, DATEADD(month, 0,
tbPatientMeasurement.Taken), 101), 121), '-', ','), ' ', ','), ':', ',') AS Created, tbVitalDisplayConfig.SequenceID, tbPatientMeasurement.CitizenIDF
FROM tbPatientMeasurement INNER JOIN
tbMeasurement ON tbPatientMeasurement.MeasurementIDF = tbMeasurement.MeasurementIDP INNER JOIN
tbUOM ON tbMeasurement.DefaultUOM = tbUOM.UOMIDP INNER JOIN
tbPatientChartConfig ON tbMeasurement.MeasurementIDP = tbPatientChartConfig.MeasurementIDF LEFT OUTER JOIN
tbVitalDisplayConfig ON tbMeasurement.MeasurementIDP = tbVitalDisplayConfig.MeasurementIDF
WHERE (tbPatientMeasurement.CitizenIDF = 16)
ORDER BY CASE WHEN SequenceID IS NULL THEN 1 ELSE 0 END, tbVitalDisplayConfig.SequenceID]]>
</queryString>
<field name="MeasurementValue" class="java.lang.String"/>
<field name="Taken" class="java.sql.Timestamp"/>
<field name="MeasurementName" class="java.lang.String"/>
<field name="MeasurementIDF" class="java.lang.Integer"/>
<field name="UOMName" class="java.lang.String"/>
<field name="PatientMeasurementIDP" class="java.lang.Integer"/>
<field name="SequenceID" class="java.lang.Integer"/>
<field name="CitizenIDF" class="java.lang.Integer"/>
<field name="measurementName" class="java.lang.String"/>
<field name="measurementValue" class="java.lang.String"/>
<field name="created" class="java.lang.String"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="131">
<textField>
<reportElement x="273" y="44" width="51" height="14"/>
<textElement/>
<textFieldExpression><![CDATA[$P{gender}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="324" y="56" width="78" height="14"/>
<textElement>
<font isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{ContactType}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="68" y="44" width="52" height="14"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[DOB :]]></text>
</staticText>
<line>
<reportElement x="11" y="107" width="530" height="1"/>
</line>
<staticText>
<reportElement stretchType="RelativeToBandHeight" x="238" y="108" width="100" height="20"/>
<textElement textAlignment="Center">
<font size="12" isBold="true"/>
</textElement>
<text><![CDATA[Vital Chart]]></text>
</staticText>
<textField>
<reportElement x="120" y="56" width="78" height="14"/>
<textElement/>
<textFieldExpression><![CDATA[$P{citizenID}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="200" y="56" width="73" height="14"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Marital Status : ]]></text>
</staticText>
<staticText>
<reportElement x="324" y="44" width="78" height="14"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Blood Group :]]></text>
</staticText>
<textField>
<reportElement x="120" y="44" width="80" height="14"/>
<textElement/>
<textFieldExpression><![CDATA[$P{DOB}]]></textFieldExpression>
</textField>
<image>
<reportElement x="10" y="10" width="58" height="70"/>
<imageExpression><![CDATA[$P{citizenPhotoImg}]]></imageExpression>
</image>
<line>
<reportElement x="11" y="127" width="530" height="1"/>
</line>
<textField>
<reportElement x="402" y="44" width="136" height="14"/>
<textElement/>
<textFieldExpression><![CDATA[$P{bloodGroup}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="273" y="56" width="51" height="14"/>
<textElement/>
<textFieldExpression><![CDATA[$P{MaritalStatus}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="200" y="44" width="73" height="14"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[Gender :]]></text>
</staticText>
<textField>
<reportElement x="402" y="58" width="136" height="14"/>
<textElement/>
<textFieldExpression><![CDATA[$P{ContactDetails}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="68" y="26" width="473" height="14"/>
<textElement/>
<textFieldExpression><![CDATA[$P{address}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="68" y="10" width="292" height="16"/>
<textElement>
<font size="12" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$P{name}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="68" y="56" width="52" height="14"/>
<textElement>
<font isBold="true"/>
</textElement>
<text><![CDATA[MedicoID : ]]></text>
</staticText>
</band>
</title>
<lastPageFooter>
<band height="355">
<timeSeriesChart>
<chart isShowLegend="true" evaluationTime="Report" renderType="draw">
<reportElement positionType="FixRelativeToBottom" mode="Transparent" x="0" y="0" width="550" height="322" isPrintWhenDetailOverflows="true"/>
<chartTitle position="Top"/>
<chartSubtitle/>
<chartLegend/>
</chart>
<timeSeriesDataset timePeriod="Milisecond">
<timeSeries>
<seriesExpression><![CDATA[$F{measurementName}]]></seriesExpression>
<timePeriodExpression><![CDATA[new SimpleDateFormat("yyyy,MM,dd,HH,mm").parse($F{created})]]></timePeriodExpression>
<valueExpression><![CDATA[Double.valueOf($F{measurementValue})]]></valueExpression>
</timeSeries>
</timeSeriesDataset>
<timeSeriesPlot isShowLines="true" isShowShapes="true">
<plot backgroundAlpha="1.0" labelRotation="55.0"/>
</timeSeriesPlot>
</timeSeriesChart>
</band>
</lastPageFooter>
<summary>
<band height="127" splitType="Stretch">
<crosstab ignoreWidth="true">
<reportElement positionType="Float" x="0" y="0" width="550" height="104"/>
<crosstabHeaderCell>
<cellContents backcolor="#66FF33"/>
</crosstabHeaderCell>
<rowGroup name="Taken" width="0">
<bucket order="Descending" class="java.lang.String">
<bucketExpression><![CDATA[(new SimpleDateFormat("yyyy")).format($F{Taken})]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="0" height="0"/>
<textElement/>
<textFieldExpression><![CDATA[$V{Taken}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<rowGroup name="Taken1" width="93">
<bucket order="Descending" class="java.lang.String">
<bucketExpression><![CDATA[(new SimpleDateFormat("dd-MM-yyyy HH:mm")).format($F{Taken})]]></bucketExpression>
</bucket>
<crosstabRowHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="93" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$V{Taken1}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabRowHeader>
<crosstabTotalRowHeader>
<cellContents/>
</crosstabTotalRowHeader>
</rowGroup>
<columnGroup name="SequenceID" height="0">
<bucket class="java.lang.Integer">
<bucketExpression><![CDATA[$F{SequenceID}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="0" height="0"/>
<textElement>
<font size="9"/>
</textElement>
<textFieldExpression><![CDATA[$V{SequenceID}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="MeasurementName" height="21">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{MeasurementName}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="61" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementName}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<columnGroup name="UOMName" height="20">
<bucket class="java.lang.String">
<bucketExpression><![CDATA[$F{UOMName}]]></bucketExpression>
</bucket>
<crosstabColumnHeader>
<cellContents backcolor="#F0F8FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="61" height="20"/>
<textElement/>
<textFieldExpression><![CDATA[$V{UOMName}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabColumnHeader>
<crosstabTotalColumnHeader>
<cellContents/>
</crosstabTotalColumnHeader>
</columnGroup>
<measure name="MeasurementValueMeasure" class="java.lang.String">
<measureExpression><![CDATA[$F{MeasurementValue}]]></measureExpression>
</measure>
<crosstabCell width="61" height="16">
<cellContents>
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField isBlankWhenNull="true">
<reportElement style="Crosstab Data Text" x="0" y="0" width="61" height="16"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="Taken">
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="MeasurementName">
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="Taken" columnTotalGroup="MeasurementName">
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell width="50" columnTotalGroup="UOMName">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="Taken" columnTotalGroup="UOMName">
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell height="25" rowTotalGroup="Taken1">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="Taken1" columnTotalGroup="MeasurementName">
<cellContents backcolor="#005FB3" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25" forecolor="#FFFFFF"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
<crosstabCell rowTotalGroup="Taken1" columnTotalGroup="UOMName">
<cellContents backcolor="#BFE1FF" mode="Opaque">
<box>
<pen lineWidth="0.5" lineStyle="Solid" lineColor="#000000"/>
</box>
<textField>
<reportElement style="Crosstab Data Text" x="0" y="0" width="50" height="25"/>
<textElement/>
<textFieldExpression><![CDATA[$V{MeasurementValueMeasure}]]></textFieldExpression>
</textField>
</cellContents>
</crosstabCell>
</crosstab>
</band>
</summary>
</jasperReport>
答案 0 :(得分:0)
您可以尝试以下两种解决方案: -
1: - 通过右键单击乐队,尝试最大化两个乐队的乐队高度。
2: - 第二个选项太使用“报告组”,你可以为图表和交叉表添加两个报告组,添加报告组转到“报告检查器”右键单击报告然后选择“添加报告组”