I have a main subreport, that contains two similar subreports placed next to each other.
These two similar subreports both contain a text field in the detail band. Detail band is set to stretch.
My problem is when one of the text fields contain a long text, and the other is not,there will be a "gap" on side with the short text. The text field with the short text should stretch also.
Is there a way to achive this while maintaining two separate subreports? Or do I have create one subreport from the two, putting both text fields into one subreport?
Here's a simplifeid version of the main subreport, and the two subreport containing the text fields.
Main report:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<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="Invoice" pageWidth="595" pageHeight="255" columnWidth="595" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="InvoiceBundle" uuid="4328d8a4-e5d5-4d7d-9fba-b42407325799">
<property name="ireport.zoom" value="1.5000000000000007"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="develop trunk"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<parameter name="ID" class="java.lang.Long">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="SUBREPORT_DIR" class="java.lang.String">
<defaultValueExpression><![CDATA["./"]]></defaultValueExpression>
</parameter>
<parameter name="DATEFORMAT" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT 1 -- This is a must, because subreports in Detail Band will only show data if the query has result. TODO: Move this supreport into Header Band.]]>
</queryString>
<detail>
<band height="240" splitType="Stretch">
<frame>
<reportElement style="table" positionType="Float" x="0" y="140" width="555" height="80" uuid="ee798e27-e04b-46e1-ae6b-b85f881d6878"/>
<box>
<topPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<leftPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
<rightPen lineWidth="1.0" lineStyle="Solid" lineColor="#000000"/>
</box>
<subreport isUsingCache="false">
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="300" height="80" uuid="2b946dfa-c599-4ea2-873b-d68073885475"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="REPORT_RESOURCE_BUNDLE">
<subreportParameterExpression><![CDATA[$P{REPORT_RESOURCE_BUNDLE}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "Left.jasper"]]></subreportExpression>
</subreport>
<subreport isUsingCache="false">
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="300" y="0" width="255" height="80" uuid="aa26fd8b-b945-4d61-b3c6-2019f1e2c779"/>
<subreportParameter name="SUBREPORT_DIR">
<subreportParameterExpression><![CDATA[$P{SUBREPORT_DIR}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="REPORT_RESOURCE_BUNDLE">
<subreportParameterExpression><![CDATA[$P{REPORT_RESOURCE_BUNDLE}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "Right.jasper"]]></subreportExpression>
</subreport>
</frame>
</band>
</detail>
</jasperReport>
Subreport on the left side, called Left.jasper:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<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="Invoice" pageWidth="300" pageHeight="255" columnWidth="300" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="InvoiceBundle" uuid="4328d8a4-e5d5-4d7d-9fba-b42407325799">
<property name="ireport.zoom" value="1.5000000000000007"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="develop trunk"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<parameter name="SUBREPORT_DIR" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="DATEFORMAT" class="java.lang.String"/>
<queryString>
<![CDATA[SELECT 'this is a short text' AS short_text]]>
</queryString>
<field name="short_text" class="java.lang.String"/>
<detail>
<band height="80" splitType="Stretch">
<frame>
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="300" height="80" uuid="7688bc26-63fe-4013-b7dc-514f2f078be1"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="5" y="20" width="245" height="15" isPrintWhenDetailOverflows="true" uuid="c71b1e9d-f637-4511-b304-ba5a9603331e"/>
<textElement>
<font fontName="DejaVu Sans" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{short_text}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
</jasperReport>
Subreport on the right side, called Right.jasper:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<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="Invoice" pageWidth="255" pageHeight="255" columnWidth="255" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" resourceBundle="InvoiceBundle" uuid="4328d8a4-e5d5-4d7d-9fba-b42407325799">
<property name="ireport.zoom" value="1.5000000000000007"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="develop trunk"/>
<property name="com.jaspersoft.studio.data.sql.tables" value=""/>
<style name="table">
<box>
<pen lineWidth="1.0" lineColor="#000000"/>
</box>
</style>
<parameter name="SUBREPORT_DIR" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select 'This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
This is a very long text, that makes the text field stretch.
' AS long_text]]>
</queryString>
<field name="long_text" class="java.lang.String"/>
<detail>
<band height="80" splitType="Stretch">
<frame>
<reportElement style="table" positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="255" height="80" uuid="9402fe9b-072f-4d99-9686-eaf896fa5281"/>
<textField isStretchWithOverflow="true" isBlankWhenNull="true">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="5" y="20" width="250" height="15" isPrintWhenDetailOverflows="true" uuid="cf207ce1-909e-4e80-802b-7b8dcb22f05b"/>
<textElement>
<font fontName="DejaVu Sans" size="9"/>
</textElement>
<textFieldExpression><![CDATA[$F{long_text}]]></textFieldExpression>
</textField>
</frame>
</band>
</detail>
</jasperReport>
I am trying to access the "Chart Plot" tab of my bar chart in order to change the orientation to horizontal but I'm getting this error with no further details
This error also appears when I click this tab on the other pie chart of the file.
This is the jrxml file:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.13.0.final using JasperReports Library version 6.13.0-46ada4d1be8f3c5985fd0b6146f3ed44caed6f05 -->
<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="consumption_template" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c2376118-5b9b-47c0-b7d6-a20b65a05ffb">
<subDataset name="totalKgClothesPieDataSet" uuid="72727fea-d56b-46dd-8104-9ddbf35dad68">
<parameter name="params" class="com.dosiper.laundryserver.laundry.statistics.consumption.dto.export.equipment.pdf.ExportConsumptionPDFParameters"/>
<field name="name" class="java.lang.String"/>
<field name="kgRealPercentage" class="java.lang.Double"/>
</subDataset>
<subDataset name="totalKgClothesBarDataSet" uuid="cc72577b-9c33-4f93-bc5a-0460f7084532">
<parameter name="params" class="com.dosiper.laundryserver.laundry.statistics.consumption.dto.export.equipment.pdf.ExportConsumptionPDFParameters"/>
<field name="name" class="java.lang.String"/>
<field name="kgReal" class="java.lang.Double"/>
</subDataset>
<parameter name="params" class="com.dosiper.laundryserver.laundry.statistics.consumption.dto.export.equipment.pdf.ExportConsumptionPDFParameters"/>
<field name="totalKgClothesPieDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<field name="totalKgClothesBarDataSource" class="net.sf.jasperreports.engine.data.JRBeanCollectionDataSource"/>
<group name="TotalKgClothes">
<groupHeader>
<band height="552">
<pieChart>
<chart isShowLegend="false" evaluationTime="Report">
<reportElement key="" positionType="Float" isPrintRepeatedValues="false" x="8" y="160" width="540" height="392" uuid="f656a8cf-a3d7-48ee-8128-a7fac530f9ca"/>
<chartTitle>
<font fontName="Arial" size="14" isBold="true"/>
<titleExpression><![CDATA[$P{params}.getTotalKgClothesPieChartTitle()]]></titleExpression>
</chartTitle>
<chartSubtitle/>
<chartLegend/>
</chart>
<pieDataset maxCount="30">
<dataset resetType="Report">
<datasetRun subDataset="totalKgClothesPieDataSet" uuid="e50e959c-3556-430b-97b2-c9bc4ccc10f2">
<datasetParameter name="params">
<datasetParameterExpression><![CDATA[$P{params}]]></datasetParameterExpression>
</datasetParameter>
<dataSourceExpression><![CDATA[$F{totalKgClothesPieDataSource}]]></dataSourceExpression>
</datasetRun>
</dataset>
<keyExpression><![CDATA[$F{name}]]></keyExpression>
<valueExpression><![CDATA[$F{kgRealPercentage}]]></valueExpression>
<labelExpression><![CDATA[$F{name}.toLowerCase()]]></labelExpression>
</pieDataset>
<piePlot>
<plot/>
<itemLabel/>
</piePlot>
</pieChart>
</band>
</groupHeader>
</group>
<group name="TotalKgClothesBarChart">
<groupHeader>
<band height="367">
<barChart>
<chart evaluationTime="Report">
<reportElement x="8" y="10" width="542" height="350" uuid="d4072751-ba5d-4c03-8a2d-f2ab02960e59"/>
<chartTitle>
<font fontName="Arial" size="14" isBold="true"/>
<titleExpression><![CDATA[$P{params}.getTotalKgClothesBarChartTitle()]]></titleExpression>
</chartTitle>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset resetType="Report">
<datasetRun subDataset="totalKgClothesBarDataSet" uuid="a763eb3e-b77a-4976-9264-475e19713a73">
<dataSourceExpression><![CDATA[$F{totalKgClothesBarDataSource}]]></dataSourceExpression>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{name}]]></seriesExpression>
<categoryExpression><![CDATA[$F{name}]]></categoryExpression>
<valueExpression><![CDATA[$F{kgReal}]]></valueExpression>
<labelExpression><![CDATA[$F{name}]]></labelExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot/>
<itemLabel/>
<categoryAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</categoryAxisFormat>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" axisLineColor="#000000"/>
</valueAxisFormat>
</barPlot>
</barChart>
</band>
</groupHeader>
</group>
</jasperReport>
If possible, do you know how to edit the jrxml file to add the "horizontal" orientation manually?
This seems to be something related to version 6.13.0, it works with version "6.12.2" so I just opened an issue in their bug tracker.
Thanks.
I have created a jasper report with following xml,
<?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="SUB_MS_ICM_SUMMERY" language="groovy" pageWidth="842" pageHeight="590" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="0.75"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<subDataset name="incident_category_1">
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select category,count from (SELECT 'Total' As category,COUNT(*) as count FROM ms_icm_incident i
where incident_category<>3 and status <> 'Cancelled' and (trunc(nvl(i.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
union
select decode(inc.incident_category,1,'Actual Incident',2,'Near Hit')
,count(inc.incident_id) as cnt
from ms_icm_incident inc
where inc.incident_category <>3 and inc.status<>'Cancelled'
and (trunc(nvl(inc.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
group by inc.incident_category
union
SELECT decode(lov.STORED_VALUE,1,'Actual Incident',2,'Near Hit') as incident_category, 0 as cnt
FROM ms_local_lov_t lov
WHERE LOV_NAME='MS_ICM_CATEGORY' and lov.STORED_VALUE <>3
and lov.STORED_VALUE not in (select inc.incident_category
from ms_icm_incident inc
where inc.incident_category <>3 and inc.status<>'Cancelled'
and (trunc(nvl(inc.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))))
order by decode(category,'Total',1 )]]>
</queryString>
<field name="CATEGORY" class="java.lang.String"/>
<field name="COUNT" class="java.math.BigDecimal"/>
</subDataset>
<subDataset name="incident_severity_1">
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select severity, sum(cnt) from
(select POTENTIAL_SEVERITY_CALCULATED as severity, count(*) as cnt
from ms_icm_incident where incident_category<>3 and POTENTIAL_SEVERITY_CALCULATED is not null and status <> 'Cancelled' and(trunc(nvl(initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
group by POTENTIAL_SEVERITY_CALCULATED)
dual group by severity
order by decode(severity,'High',1,'Medium',2,'Low',3)]]>
</queryString>
<field name="SEVERITY" class="java.lang.String"/>
<field name="SUM(CNT)" class="java.math.BigDecimal"/>
</subDataset>
<subDataset name="Incident_status_1">
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[select status,cnt from (select status, count(*) as cnt from ms_icm_incident
where incident_category<>3 and (trunc(nvl(initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))and status <> 'Cancelled'
group by status
union
select status, cnt from (select distinct status,0 as cnt from ms_icm_flow_action_status
union
select 'Closed',0 as cnt from dual) where STATUS NOT IN
(select status from ms_icm_incident
where incident_category<>3 and (trunc(nvl(initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))and status <> 'Cancelled'
group by status)and status not in ( 'Cancelled','OHS Investigating','Initiating Incident')
)
order by decode (status,
'Initiated',1,
'Initiated - Need More Info',2,
'Preliminary',3,
'Investigating',4,
'Draft Report Review',5,
'Final Report Review',6,
'Re-Investigating',7,
'Final',8,
'Closed',9,
'Completed',10)]]>
</queryString>
<field name="STATUS" class="java.lang.String"/>
<field name="CNT" class="java.math.BigDecimal"/>
</subDataset>
<parameter name="start_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<parameter name="end_date" class="java.lang.String">
<defaultValueExpression><![CDATA[]]></defaultValueExpression>
</parameter>
<queryString>
<![CDATA[SELECT 'Total' As category,COUNT(*) as count FROM ms_icm_incident i
where incident_category<>3 and (trunc(nvl(i.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
union
select (SELECT lov.DISPLAYED_VALUE
FROM ms_local_lov_t lov
WHERE lov.STORED_VALUE=i.incident_category
and LOV_NAME='MS_ICM_CATEGORY')as category, count(*) from ms_icm_incident i
where incident_category<>3 and (trunc(nvl(i.initiated_on,$P{start_date})) between to_char(to_date($P{start_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy') and to_char(to_date($P{end_date},'mm/dd/yyyy HH24:MI:SS'),'dd-MON-yyyy'))
group by incident_category]]>
</queryString>
<field name="CATEGORY" class="java.lang.String"/>
<field name="COUNT" class="java.math.BigDecimal"/>
<background>
<band splitType="Stretch"/>
</background>
<columnHeader>
<band height="505">
<barChart>
<chart isShowLegend="false">
<reportElement x="15" y="191" width="772" height="280"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="incident_severity_1">
<datasetParameter name="start_date">
<datasetParameterExpression><![CDATA[$P{start_date}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="end_date">
<datasetParameterExpression><![CDATA[$P{end_date}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{SEVERITY}]]></seriesExpression>
<categoryExpression><![CDATA[$F{SEVERITY}]]></categoryExpression>
<valueExpression><![CDATA[$F{SUM(CNT)}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot orientation="Horizontal" labelRotation="0.0"/>
<itemLabel/>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" verticalTickLabels="false" axisLineColor="#000000"/>
</valueAxisFormat>
<rangeAxisMinValueExpression><![CDATA[0]]></rangeAxisMinValueExpression>
<rangeAxisMaxValueExpression><![CDATA[$F{COUNT}]]></rangeAxisMaxValueExpression>
</barPlot>
</barChart>
<barChart>
<chart isShowLegend="false">
<reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="45" width="802" height="113" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="incident_category_1">
<datasetParameter name="start_date">
<datasetParameterExpression><![CDATA[$P{start_date}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="end_date">
<datasetParameterExpression><![CDATA[$P{end_date}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{CATEGORY}]]></seriesExpression>
<categoryExpression><![CDATA[$F{CATEGORY}]]></categoryExpression>
<valueExpression><![CDATA[$F{COUNT}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot isShowLabels="true" isShowTickLabels="true" isShowTickMarks="true">
<plot orientation="Horizontal" labelRotation="0.0"/>
<itemLabel/>
<rangeAxisMinValueExpression><![CDATA[0]]></rangeAxisMinValueExpression>
<rangeAxisMaxValueExpression><![CDATA[$F{COUNT}]]></rangeAxisMaxValueExpression>
</barPlot>
</barChart>
<staticText>
<reportElement mode="Opaque" x="2" y="0" width="795" height="33" forecolor="#FF0000" backcolor="#00CCCC"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="18" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Incident Category ]]></text>
</staticText>
<staticText>
<reportElement mode="Opaque" x="1" y="158" width="795" height="33" forecolor="#FF0000" backcolor="#00CCCC"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="18" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Incident Severity]]></text>
</staticText>
</band>
</columnHeader>
<summary>
<band height="507" splitType="Stretch">
<barChart>
<chart isShowLegend="false">
<reportElement x="4" y="43" width="783" height="404"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<categoryDataset>
<dataset>
<datasetRun subDataset="Incident_status_1">
<datasetParameter name="start_date">
<datasetParameterExpression><![CDATA[$P{start_date}]]></datasetParameterExpression>
</datasetParameter>
<datasetParameter name="end_date">
<datasetParameterExpression><![CDATA[$P{end_date}]]></datasetParameterExpression>
</datasetParameter>
</datasetRun>
</dataset>
<categorySeries>
<seriesExpression><![CDATA[$F{STATUS}]]></seriesExpression>
<categoryExpression><![CDATA[$F{STATUS}]]></categoryExpression>
<valueExpression><![CDATA[$F{CNT}]]></valueExpression>
</categorySeries>
</categoryDataset>
<barPlot>
<plot orientation="Horizontal" labelRotation="0.0"/>
<itemLabel/>
<valueAxisFormat>
<axisFormat labelColor="#000000" tickLabelColor="#000000" verticalTickLabels="false" axisLineColor="#000000"/>
</valueAxisFormat>
<rangeAxisMinValueExpression><![CDATA[0]]></rangeAxisMinValueExpression>
<rangeAxisMaxValueExpression><![CDATA[$F{COUNT}]]></rangeAxisMaxValueExpression>
</barPlot>
</barChart>
<staticText>
<reportElement mode="Opaque" x="2" y="0" width="795" height="33" forecolor="#FF0000" backcolor="#00CCCC"/>
<box>
<pen lineWidth="0.5"/>
<topPen lineWidth="0.0"/>
<leftPen lineWidth="0.0"/>
<bottomPen lineWidth="0.0"/>
<rightPen lineWidth="0.0"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="18" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[Incident Status]]></text>
</staticText>
<image>
<reportElement x="0" y="457" width="799" height="50"/>
<imageExpression><![CDATA["MSI.png"]]></imageExpression>
</image>
</band>
</summary>
</jasperReport>
Now i am getting the chart as overflown,i have changed the following properties,
Set "Position" to "Float"
Set "Stretch Type" to "Relative to the tallest object"
Checked "Print when detail overflows" checkbox.
But still no help.
my Jasper version is 4.5.0
Please assist.
Try Putting isPrintWhenDetailOverflows="true" inside every reportElement tag you are using. You have put this in only one of your tag.
Through this the element will be reprinted on the next page if the band does not fit in the current page.
I'm using iReport to display a pie chart with 6 different fields. I use 3.1.4 because it is compatible with Bizflow Advreport. When previewing the chart in iReport 3.1.4 the pie chart/legend/titles all show up correctly. But, when I place this on the site it only displays the title. Bringing the file into 5.0.1 nothing shows up, exactly like it does on the website.
I have tried to mess with the margins and the size of the bands, but I cannot seem to get the pie chart to display correctly.
I have also attached the two different previews I receive one from 3.1.4:
and the other from 5.0.1:
Also here is the jrxml file:
<?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>
Does anyone know what could be causing this issue. I can provide files if that is needed as well.
It seems from XML you have put pie chart in <columnhearder> band try to put the chart in <summary> band.
<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>
Try this:-
<?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>
I have a line graph in iReport which is incrementally repeating in every page, that is, if the graph has 30 x/y pairs (this is dynamic), the report will have 30 pages, of which the first will have just one value, the 2nd two values, and so on. Only the last one will contain the complete graph.
Questions "chart repeat many time" and "Problem with charting using JasperReport" and "How to print the grand total only in the last page of a very long report?" did not solve my problem. I understand that putting the chart in the Detail section makes the chart repeat, but putting it in the Summary, Footer, lastPageFooter, Title, etc. sections makes it display only one value. Same when I put it in the Detail section and use <printWhenExpression>.
My code:
<?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="nodes-allarmipersistenti" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" 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="0"/>
<field name="day" class="java.lang.Number"/>
<field name="month" class="java.lang.String"/>
<field name="year" class="java.lang.String"/>
<field name="dsunita" class="java.lang.String"/>
<field name="valueNumber" class="java.lang.Number"/>
<field name="logo" class="java.lang.String"/>
<field name="today" class="java.lang.String"/>
<field name="option" class="java.lang.String"/>
<title>
<band height="89">
<staticText>
<reportElement mode="Opaque" x="0" y="67" width="424" height="22" backcolor="#CCFFFF"/>
<textElement textAlignment="Right" verticalAlignment="Middle" markup="none">
<font size="10" isBold="true" pdfFontName="Helvetica-Bold" isPdfEmbedded="true"/>
</textElement>
<text><![CDATA[GRAFICO PARAMETRO]]></text>
</staticText>
<staticText>
<reportElement x="600" y="0" width="100" height="38"/>
<textElement verticalAlignment="Middle"/>
<text><![CDATA[Stampato in data]]></text>
</staticText>
<textField>
<reportElement x="700" y="0" width="102" height="38"/>
<textElement textAlignment="Right" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[$F{today}]]></textFieldExpression>
</textField>
<image>
<reportElement x="0" y="0" width="100" height="67"/>
<imageExpression><![CDATA[$F{logo}]]></imageExpression>
</image>
<staticText>
<reportElement x="700" y="38" width="102" height="29"/>
<textElement textAlignment="Right"/>
<text><![CDATA[MaRe - Telecontrollo]]></text>
</staticText>
<textField>
<reportElement mode="Opaque" x="424" y="67" width="378" height="22" backcolor="#CCFFFF"/>
<textElement verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[' ' + $F{option}]]></textFieldExpression>
</textField>
</band>
</title>
<lastPageFooter>
<band height="387" splitType="Stretch">
<xyLineChart>
<chart evaluationTime="Page">
<reportElement x="0" y="0" width="802" height="387"/>
<chartTitle/>
<chartSubtitle/>
<chartLegend/>
</chart>
<xyDataset>
<dataset incrementType="Report"/>
<xySeries>
<seriesExpression><![CDATA["Unità " + $F{dsunita}]]></seriesExpression>
<xValueExpression><![CDATA[$F{day}]]></xValueExpression>
<yValueExpression><![CDATA[$F{valueNumber}]]></yValueExpression>
</xySeries>
</xyDataset>
<linePlot>
<plot/>
</linePlot>
</xyLineChart>
</band>
</lastPageFooter>
</jasperReport>
Datasource here is a JRBeanCollectionDataSource.
Putting it in the Detail band is wrong (as you noticed). Putting it in the Title or Summary will work. Your choice of evaluationTime="Page" doesn't look right. Try changing this to evaluationTime="Report"