Jump to content
Changes to the Jaspersoft community edition download ×

Date on Axis Chart


2005 IR Help

Recommended Posts

By: map - map3170013

Date on Axis Chart

2005-12-05 10:21

Hello,

 

I've a problem in a chart built on iReport. This chart just displays quantities in a axis and dates related to these in another axi. But, the date information isn't been displayed correctly. The data comes from a query (database is Oracle).

 

The field is on Time Series, like that:

 

$F{dateValue}

 

For example:

Query result:

Quantity: 10000

Date Value: 2005-05-12

 

On the chart, the quantity is displayed OK, but the date information is displayd like "00:00:00.000"

 

I've tried to format it, but no success, like that:

 

1. I've created a variable called "parse" and in it expression I've inputed:

new java.text.SimpleDateFormat("dd/MM/yyyy")

 

2. In time series, I've tried to format like that:

 

$V{parser}.format($F{dateValue}) (wrong)

$V{parser}.format($F{dateValue}.toString()) (wrong too)

new Date($V{parser}.format($F{dateValue}())) (wrong too)

 

Please, I'm not getting to solve this issue and I would appreciate any help.

Thanks a lot!

Regards,

Marcelo

 

 

 

 

 

 

 

 

By: kevinl - kevinl70

RE: Date on Axis Chart

2005-12-12 13:10

Marcelo,

If you are using an Oracle query to pull back data, use the TO_CHAR(date,'MM/dd/yy') function. Here you can specify the way the date is shown to the viewer. Here is a good link for that: http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96540/functions134a.htm#1009326.

 

As we are on the subject, has anyone figured out on to format rotation for the X-axis labels? I need to show dates, but as my reports could be showing up to years of data in a bar chart, all of the lables are mutated together. Thanks.

 

 

 

 

By: map - map3170013

RE: Date on Axis Chart

2005-12-13 06:58

Hi Kevin,

 

Thanks for your help. I've got to solve my problem and your information was very appreciated.

 

Regarding your problem, unfortunately I didn't understand it. Please, can you give me more information? Maybe I can help you to solve this problem.

 

Thanks

Regards!

Marcelo

 

 

 

 

By: kevinl - kevinl70

RE: Date on Axis Chart

2005-12-15 11:42

Marcelo,

Sorry about the vagueness of my issue. But the problem I am encountering is the orientation of the X-axis labels. Currently the labels are in horizontal alignment. But I need to show the lables in a vertical alignment. As my users could be pulling data from a 1 month period up to an 18 month period. I know there is a Rotation choice for a textfield and static field, but have not seen anything for the graph labels. With my luck, there is probably something simple that I am overlooking.

 

Thanks.

Kevin

 

 

 

 

By: map - map3170013

RE: Date on Axis Chart

2005-12-19 09:54

Kevin,

Thanks for your answer. I'm sorry by late because I was out of office. I understood your problem. I've checked my library and I asked my coworkers this issue, but they really don't know how to perform this rotation of the label too. But, I will keep trying how to perform the rotation. If I have some news, I'm going to get in contact with you.

Keep trying you too... good luck!

Thks and regards,

Marcelo

 

 

 

 

By: kevinl - kevinl70

RE: Date on Axis Chart

2005-12-20 08:30

Marcelo,

Thanks for your reply. I will also keep checking and looing for an answer, and if I find one, I will post the solution on here.

 

Kevin

Link to comment
Share on other sites

  • 3 months later...
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

  • 3 months later...

Hi

Sorry for the way i open the issue.

I have created a jasper report . I am using a time series chart for that report. All the things are going right.But the problem is that in the label of x-axis rather time axis i am getting date interval as let say 30-NOV, 15-DEC,30-DEC etc.. in this way. But the year part is missing. I want date interval will show as like 30-NOV-2006, 15-DEC-2006,30-DEC-2006. In my data source i have day,month,year specifically.

Please give me idea What property of time series chart should i change to get this result or should i need to write some customizer class by which i will get the complete date format in the time axis label?

 

I have column for days(let say Tuesday,Monday..etc.) and column for dates(let say 1-Dec-06,2-Dec-06.)in this way. also some other columns for values.Also when i am displaying the date value in the detail part of jasper report I am getting the complete format of date value.

 

Please let me know If you don't understand my problem

 

Thanks in advance.

Atanu Panda

Here is the code for my file.

 

[code:1]<?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="Average Touch Time Primary Rush Exception"

columnCount="1"

printOrder="Vertical"

orientation="Portrait"

pageWidth="595"

pageHeight="842"

columnWidth="535"

columnSpacing="0"

leftMargin="30"

rightMargin="30"

topMargin="20"

bottomMargin="20"

whenNoDataType="NoPages"

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.*" />

 

<queryString><![CDATA[select * from averagetouchtime]]></queryString>

 

<field name="Average Touch Time_id" class="java.lang.Long"/>

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

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

<field name="Average Touch Time Primary Non Rush Exception" class="java.lang.Double"/>

<field name="Average Touch Time Secondary Non Rush Exception" class="java.lang.Double"/>

<field name="Average Touch Time Primary Non Rush Standard" class="java.lang.Double"/>

<field name="Average Touch Time Secondary Non Rush Standard" class="java.lang.Double"/>

<field name="Average Touch Time Primary Rush Exception" class="java.lang.Double"/>

<field name="Average Touch Time Secondary Rush Exception" class="java.lang.Double"/>

<field name="Average Touch Time Primary Rush Standard" class="java.lang.Double"/>

<field name="Average Touch Time Secondary Rush Standard" class="java.lang.Double"/>

 

<variable name="daytime" class="java.lang.String" resetType="Report" calculation="Nothing">

<variableExpression><![CDATA[$F{day}+","+$F{date}.substring(0,$F{date}.indexOf( "-", 4 ))+"-20"+$F{date}.substring($F{date}.indexOf( "-", 4 )+1,$F{date}.length())]]></variableExpression>

</variable>

<variable name="parse" class="java.text.SimpleDateFormat" resetType="Report" calculation="Nothing">

<variableExpression><![CDATA[new SimpleDateFormat("EEEE,d-MMM-yyyy"«»)]]></variableExpression>

</variable>

<variable name="certificatetime" class="java.util.Date" resetType="Report" calculation="Nothing">

<variableExpression><![CDATA[$V{parse}.parse($V{daytime})]]></variableExpression>

</variable>

<variable name="index" class="java.lang.Integer" resetType="Report" calculation="Nothing">

<variableExpression><![CDATA[new Integer($F{date}.indexOf( "-", 4 ))]]></variableExpression>

</variable>

<background>

<band height="0" isSplitAllowed="true" >

</band>

</background>

<title>

<band height="0" isSplitAllowed="true" >

</band>

</title>

<pageHeader>

<band height="1" isSplitAllowed="true" >

</band>

</pageHeader>

<columnHeader>

<band height="0" isSplitAllowed="true" >

</band>

</columnHeader>

<detail>

<band height="0" isSplitAllowed="true" >

</band>

</detail>

<columnFooter>

<band height="0" isSplitAllowed="true" >

</band>

</columnFooter>

<pageFooter>

<band height="0" isSplitAllowed="true" >

</band>

</pageFooter>

<summary>

<band height="390" isSplitAllowed="true" >

<rectangle radius="5" >

<reportElement

mode="Transparent"

x="3"

y="0"

width="529"

height="384"

forecolor="#000000"

key="rectangle-1"/>

<graphicElement stretchType="NoStretch" pen="1Point"/>

</rectangle>

<timeSeriesChart>

<chart isShowLegend="false" hyperlinkTarget="Self" >

<reportElement

x="13"

y="5"

width="508"

height="370"

key="element-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<chartTitle color="#000066" >

<font fontName="SansSerif" pdfFontName="Helvetica" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="false" pdfEncoding="Cp1252"/>

<titleExpression><![CDATA["Certificates - Primary Rush Exception"]]></titleExpression>

</chartTitle>

</chart>

<timeSeriesDataset>

<dataset >

</dataset>

<timeSeries>

<seriesExpression><![CDATA["Average Touch Time Primary Rush Exception"]]></seriesExpression>

<timePeriodExpression><![CDATA[$V{certificatetime}]]></timePeriodExpression>

<valueExpression><![CDATA[$F{Average Touch Time Primary Rush Exception}]]></valueExpression>

<itemHyperlink >

</itemHyperlink>

</timeSeries>

</timeSeriesDataset>

<timeSeriesPlot >

<plot >

<seriesColor seriesOrder="0" color="#FF66FF"/>

</plot>

<timeAxisFormat>

<axisFormat >

</axisFormat>

</timeAxisFormat>

<valueAxisLabelExpression><![CDATA["Average Touch Time"]]></valueAxisLabelExpression>

<valueAxisFormat>

<axisFormat labelColor="#330033" >

<labelFont>

<font fontName="SansSerif" pdfFontName="Helvetica" size="12" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" isPdfEmbedded="true" pdfEncoding="Cp1252"/>

</labelFont>

<tickLabelFont>

</tickLabelFont>

</axisFormat>

</valueAxisFormat>

</timeSeriesPlot>

</timeSeriesChart>

</band>

</summary>

</jasperReport>

[/code:1]

Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...

Hello,

You may have already gotten the answer to this as this is an old post but for rotation on X axis, use Label rotation under common properties for the chart. The value is in degrees so a setting of 90 will result in vertically placed labels on x axis.

Hope this helps!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...