okt Posted September 16, 2008 Share Posted September 16, 2008 Hi All, I am trying to finish a project using ireports 3.0 /jasperserver 3.0 RC1For this project i need to display a simple time series, and the number of events per day for 3 series. I selected Time Period = Day.My problem is that instead of diplaying one value along the x-axis , i get two for each day.The labels are 16-sept 00:00 and 16-spet 12:00 for instance.i tried changing the data type for the filed with little succes.What am i doing wrong?Code:<?xml version="1.0" encoding="UTF-8" ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="Exec_ErrorBucket spec" columnCount="1" printOrder="Vertical" orientation="Landscape" pageWidth="842" pageHeight="595" columnWidth="842" columnSpacing="0" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenNoDataType="NoDataSection" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="0" /> <property name="ireport.encoding" value="UTF-8" /> <import value="java.util.*" /> <import value="net.sf.jasperreports.engine.*" /> <import value="net.sf.jasperreports.engine.data.*" /> <style name="BoldieGlod" isDefault="false" forecolor="#800000" fontName="Verdana" fontSize="12" > </style> <subDataset name="ErrBucketCharts" > <queryString><![CDATA[sELECT Trunc(ScriptRunDate) DateRun,SUM(decode(substr(script,-1,1),'2',totalcount,0)) AS Records_gprs, 0 AS Records_interco, SUM(decode(substr(script,-1,1),'1',totalcount,0)) AS Records_voiceFROM RECON_LBC_AGINGWHERE trunc(ScriptRunDate)>=Trunc(sysdate)-30 and totalcount is not nullGROUP BY Trunc(ScriptRunDate) order by 1 asc]]></queryString> <field name="DATERUN" class="java.sql.Timestamp"/> <field name="RECORDS_GPRS" class="java.math.BigDecimal"/> <field name="RECORDS_INTERCO" class="java.math.BigDecimal"/> <field name="RECORDS_VOICE" class="java.math.BigDecimal"/> </subDataset> <queryString><![CDATA[select Scriptdate,RATE_PERCENT,CURRENCY,(AVERAGE_RATE*TotalMins*RATE_PERCENT/100) MinsValue,TotalMins,(AVERAGE_RATE_GPRS*TotalGprs*RATE_PERCENT/100) GprsValue ,TotalGprs from(SELECT TO_CHAR(ScriptRunDate,'YYYY/MM/DD') scriptdate, NVL(Round(Sum(decode(substr(script,-1,1),'1',TotalSeconds,0))/60),0) TotalMins, NVL(Round(Sum(decode(substr(script,-1,1),'2',TotalSeconds,0))/1048576),0) AS TotalGprsFROM RECON_LBC_AGINGwhere trunc(ScriptRunDate) = (select trunc(max(scriptrundate)) from RECON_LBC_AGING)GROUP BY TO_CHAR(ScriptRunDate,'YYYY/MM/DD')) EB,(select CURRENCY,AVERAGE_RATE,RATE_PERCENT,AVERAGE_RATE_GPRS from THRESHOLDS where rownum <=1 order by ID desc) T]]></queryString> <field name="SCRIPTDATE" class="java.lang.String"/> <field name="RATE_PERCENT" class="java.math.BigDecimal"/> <field name="CURRENCY" class="java.lang.String"/> <field name="MINSVALUE" class="java.math.BigDecimal"/> <field name="TOTALMINS" class="java.math.BigDecimal"/> <field name="GPRSVALUE" class="java.math.BigDecimal"/> <field name="TOTALGPRS" class="java.math.BigDecimal"/> <variable name="NumFormatter" class="java.text.NumberFormat" resetType="Report" calculation="Nothing"> <variableExpression><![CDATA[NumberFormat.getInstance()]]></variableExpression> </variable> <background> <band height="3" isSplitAllowed="true" > </band> </background> <title> <band height="338" isSplitAllowed="true" > <timeSeriesChart> <chart hyperlinkTarget="Self" > <reportElement x="13" y="9" width="764" height="294" backcolor="#C0C0C0" key="element-1"/> <box></box> <chartLegend textColor="#000000" backgroundColor="#FFFFFF" > <font fontName="Verdana" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/> </chartLegend> </chart> <timeSeriesDataset> <dataset > <datasetRun subDataset="ErrBucketCharts"> </datasetRun> </dataset> <timeSeries> <seriesExpression><![CDATA["GPRS"]]></seriesExpression> <timePeriodExpression><![CDATA[$F{DATERUN}]]></timePeriodExpression> <valueExpression><![CDATA[$F{RECORDS_GPRS}]]></valueExpression> <itemHyperlink > <hyperlinkTooltipExpression><![CDATA[$F{RECORDS_GPRS}.toString()]]></hyperlinkTooltipExpression> </itemHyperlink> </timeSeries> <timeSeries> <seriesExpression><![CDATA["Voice/SMS"]]></seriesExpression> <timePeriodExpression><![CDATA[$F{DATERUN}]]></timePeriodExpression> <valueExpression><![CDATA[$F{RECORDS_VOICE}]]></valueExpression> <itemHyperlink > <hyperlinkTooltipExpression><![CDATA[$F{RECORDS_VOICE}.toString()]]></hyperlinkTooltipExpression> </itemHyperlink> </timeSeries> <timeSeries> <seriesExpression><![CDATA["INTERCONNECT"]]></seriesExpression> <timePeriodExpression><![CDATA[$F{DATERUN}]]></timePeriodExpression> <valueExpression><![CDATA[$F{RECORDS_INTERCO}]]></valueExpression> <itemHyperlink > <hyperlinkTooltipExpression><![CDATA[$F{RECORDS_INTERCO}.toString()]]></hyperlinkTooltipExpression> </itemHyperlink> </timeSeries> </timeSeriesDataset> <timeSeriesPlot > <plot backcolor="#CCCCCC" backgroundAlpha="0.45" foregroundAlpha="0.8" labelRotation="90.0" > <seriesColor seriesOrder="0" color="#4169E1"/> <seriesColor seriesOrder="1" color="#FFA500"/> <seriesColor seriesOrder="2" color="#FF0000"/></plot> <timeAxisFormat> <axisFormat tickLabelColor="#000000" axisLineColor="#333333" > </axisFormat> </timeAxisFormat> <valueAxisFormat> <axisFormat labelColor="#FF0000" > <labelFont> <font fontName="SansSerif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/> </labelFont> <tickLabelFont> <font fontName="SansSerif" pdfFontName="Helvetica" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/> </tickLabelFont> </axisFormat> </valueAxisFormat> </timeSeriesPlot> </timeSeriesChart> </band> </title> <pageHeader> <band height="0" isSplitAllowed="true" > </band> </pageHeader> <columnHeader> <band height="30" isSplitAllowed="true" > </band> </columnHeader> <detail> <band height="53" isSplitAllowed="true" > <textField isStretchWithOverflow="true" pattern="" isBlankWhenNull="false" evaluationTime="Report" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="510" y="7" width="214" height="18" forecolor="#FF0000" key="textField-1"/> <box></box> <textElement> <font size="14"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$F{CURRENCY}+" "+ $V{NumFormatter}.format($F{MINSVALUE}.add($F{GPRSVALUE}).longValue())]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="9" y="7" width="490" height="19" key="textField-2"/> <box></box> <textElement> <font fontName="Verdana" size="14"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Current Potential Value in Error Buckets (based on "+$F{RATE_PERCENT}.toString() +"% recovery): "]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement x="9" y="34" width="226" height="15" key="textField-3"/> <box></box> <textElement> <font/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["Latest data :" + $F{SCRIPTDATE}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="8" isSplitAllowed="true" > </band> </columnFooter> <pageFooter> <band height="11" isSplitAllowed="true" > </band> </pageFooter> <lastPageFooter> <band height="5" isSplitAllowed="true" > </band> </lastPageFooter> <summary> <band height="9" isSplitAllowed="true" > </band> </summary></jasperReport> Link to comment Share on other sites More sharing options...
ahovhann Posted February 15, 2011 Share Posted February 15, 2011 Hi,I have the same problem with time axis. What should be the value of timePeriod to have only one point per date?thanks for help Annahier is a fragment from JRXML template: Code:...<field name="date" class="java.sql.Timestamp"/>...<timeSeriesChart> <chart> <reportElement x="0" y="15" width="611" height="240"/> <chartTitle/> <chartSubtitle/> <chartLegend/> </chart> <timeSeriesDataset timePeriod="Day"> <timeSeries> <seriesExpression><![CDATA[$F{id}]]></seriesExpression> <timePeriodExpression><![CDATA[$F{date}]]></timePeriodExpression> <valueExpression><![CDATA[$F{value}]]></valueExpression> <labelExpression><![CDATA[$F{id}]]></labelExpression> </timeSeries> </timeSeriesDataset> <timeSeriesPlot> <plot/> <timeAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </timeAxisFormat> <valueAxisLabelExpression><![CDATA[dd.MM.YYYY]]></valueAxisLabelExpression> <valueAxisFormat> <axisFormat> <labelFont/> <tickLabelFont/> </axisFormat> </valueAxisFormat> </timeSeriesPlot> </timeSeriesChart> Link to comment Share on other sites More sharing options...
igreenfi Posted June 11, 2012 Share Posted June 11, 2012 i have the same problem with version 4.51.do you resolve the problem? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now