Jump to content
We've recently updated our Privacy Statement, available here ×

ruchiagraw

Members
  • Posts

    3
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Posts posted by ruchiagraw

  1. Acually I have to plot timeSeries using jasperReport . How to generate the time series graph for different data sets? I am able to generate the time series graph when i have one data set to plot over a period of time. However when i have multiple data set to plot then i am facing problem.

     

    I am using List data source.

     

        public class KpiReportPoints {

            private String deviceDn;

            private List<KpiReportPoint> kpiPoints;

        }

        

        public class KPiReportPoint{

            private Date time;

            private Double value;

        

        public Date getTime() {

              

              return time;

           }

        

           

           /**

            * @param time the time to set

            */

           public void setTime(Date time) {

              this.time = time;

           }

        

           

           /**

            * @return the value

            */

           public Double getValue() {

              return value;

           }

        

           

           /**

            * @param value the value to set

            */

           public void setValue(Double value) {

              this.value = value;

           }

        

           @Override

           public int hashCode() {

              return time.hashCode();

           }

        

           @Override

           public boolean equals(Object obj) {

              boolean equal = false;

              if (obj instanceof KPIReportPoint){

                 KPIReportPoint point  = (KPIReportPoint) obj;

                 equal = time.equals(point.getTime())&& value.equals(point.getValue());

              }

              return equal;

           }

           

           @Override

           public int compareTo(KPIReportPoint o) {

              return this.time.compareTo(o.getTime());

           }

        

        }

     

    Both the above classes have their getters and setters and all are public ,so no problem according to me is there in the definition of each. I am passing the populated List<KpiReportPoints> as JRBEanCollectionDataSource(kpiReportpointsList)

     

    Now below is my 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="KPI_Reports" 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="191"/>

        <subDataset name="Dataset">

        <field name="time" class="java.util.Date"/>

        <field name="value" class="java.lang.Double"/>

        </subDataset>

        <parameter name="X_UNIT" class="java.lang.String">

        <parameterDescription><![CDATA[]]></parameterDescription>

        <defaultValueExpression><![CDATA["Date"]]></defaultValueExpression>

        </parameter>

        <parameter name="Y_UNIT" class="java.lang.String">

        <parameterDescription><![CDATA[]]></parameterDescription>

        <defaultValueExpression><![CDATA["%"]]></defaultValueExpression>

        </parameter>

        <parameter name="REPORT_NAME" class="java.lang.String">

        <defaultValueExpression><![CDATA["KPI Report"]]></defaultValueExpression>

        </parameter>

        <parameter name="from" class="java.util.Date"/>

        <parameter name="to" class="java.util.Date"/>

        <field name="deviceDn" class="java.lang.String"/>

        <field name="kpiPoints" class="java.util.List"/>

        <background>

        <band splitType="Stretch"/>

        </background>

        <title>

        <band height="20" splitType="Stretch">

        <textField pattern="EEE, d MMM yyyy HH:mm:ss Z" isBlankWhenNull="true">

        <reportElement x="513" y="0" width="253" height="20"/>

        <textElement/>

        <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>

        </textField>

        </band>

        </title>

        <summary>

        <band height="443">

        <timeSeriesChart>

        <chart isShowLegend="true" customizerClass="com.ipaccess.nos.business.pm.impl.KPIChartCustomizer">

        <reportElement mode="Opaque" x="0" y="0" width="766" height="443" isPrintInFirstWholeBand="true"/>

        <chartTitle position="Top">

        <font size="14" isBold="true" pdfFontName="Courier-Bold" isPdfEmbedded="true"/>

        <titleExpression><![CDATA[$P{REPORT_NAME}]]></titleExpression>

        </chartTitle>

        <chartSubtitle/>

        <chartLegend position="Bottom"/>

        </chart>

        <timeSeriesDataset timePeriod="Second">

                            <datasetRun subDataset="Dataset">

                                <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource($F{kpiPoints})]]></dataSourceExpression>

                            </datasetRun>

        <timeSeries>

        <seriesExpression><![CDATA[$F{deviceDn}]]></seriesExpression>

        <timePeriodExpression><![CDATA[$F{time}]]></timePeriodExpression>

        <valueExpression><![CDATA[$F{value}]]></valueExpression>

        </timeSeries>

        </timeSeriesDataset>

        <timeSeriesPlot isShowLines="true" isShowShapes="true">

        <plot labelRotation="90.0"/>

        <timeAxisLabelExpression><![CDATA[$P{X_UNIT}]]></timeAxisLabelExpression>

        <valueAxisLabelExpression><![CDATA[$P{Y_UNIT}]]></valueAxisLabelExpression>

        <valueAxisFormat>

        <axisFormat>

        <labelFont>

        <font size="10"/>

        </labelFont>

        </axisFormat>

        </valueAxisFormat>

        <domainAxisMinValueExpression><![CDATA[$P{from}]]></domainAxisMinValueExpression>

        <domainAxisMaxValueExpression><![CDATA[$P{to}]]></domainAxisMaxValueExpression>

        </timeSeriesPlot>

        </timeSeriesChart>

        </band>

        </summary>

        </jasperReport>

     

    This issue is jrxml compiles fine but on trying to generate a report it throws the exception :

     

        [#|2014-10-10T09:59:05.769+0530|SEVERE|glassfish3.1.1|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=290;_ThreadName=Thread-3;|net.sf.jasperreports.engine.JRException: Error retrieving field value from bean : time

                at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getBeanProperty(JRAbstractBeanDataSource.java:127)

                at net.sf.jasperreports.engine.data.JRAbstractBeanDataSource.getFieldValue(JRAbstractBeanDataSource.java:100)

                at net.sf.jasperreports.engine.data.JRBeanCollectionDataSource.getFieldValue(JRBeanCollectionDataSource.java:104)

            at net.sf.jasperreports.engine.fill.JRFillData

     

    I have been completely mad with this issue and not able to find even a single problem in the above code which may cause this . If any of you is able to see that and have any time faced this error then please give me some clue as to what is wrong . Thanks a lot in advance 

  2. We have a timeSeries jasper chart created for our project . So far it has only one timeSeries plotted but in the series expression it has ${id} .. Now I want to pass multiple values to this id through my java code 

    and get lines in the same chart corresponding to each id element. This means I have to define the dataTYpe of this parameter as java.util.List and then use it in jrxml file . I am not able to find a wau out of using it , can anybody help

×
×
  • Create New...