2012-03-05 30 views
2

iReportに折れ線グラフがあります。これは、グラフに30 x/yペア(これは動的)がある場合、レポートには30ページあります1つ目の値は1つの値、2つ目の2つの値などです。最後のものだけが完全なグラフを含みます。iReportでJasperレポートグラフを繰り返す

質問"chart repeat many time""Problem with charting using JasperReport""How to print the grand total only in the last page of a very long report?"は私の問題を解決していないをしました。チャートを詳細セクションに置くと、チャートが繰り返されますが、Summary、Footer、lastPageFooter、Titleなどのセクションに配置すると、1つの値しか表示されません。私がDetailセクションに入れて、<printWhenExpression>を使用した場合と同じです。

マイコード:ここ

<?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> 

データソースはJRBeanCollectionDataSourceです。

答えて

4

詳細なバンドに入れるのは間違っています(気づいた通りです)。それをタイトルまたは要約に入れることができます。 evaluationTime="Page"のあなたの選択は正しく見えません。これを変更してみてくださいevaluationTime="Report"

+0

これはうまくいきました。問題を投稿してから数時間後に見つけましたが、それは自分自身の答えには早すぎて、それから忘れました。将来の参照のために何らかの理由で前もって投票してください。 – Alessandro

関連する問題