Hi

I am very new in iReport. i have learnt a lot from this forum.

Now I am trying to draw time series chart.

In my data base I have last_computed_time (String) ex=12:30 am Jan 2nd, 07, and time_interval as String and five values like t1(double),t2(double),t3(double),t4(double),t5(double).

here aome other cols like actual value ,UCL and LCL these are double.

Now I have to draw a time series chart where

value time

----- --------

t1 last_computed_time + time _interval

t2 last_computed_time + time _interval+ time _interval

t3 last_computed_time + time _interval+ time _interval+ time _interval

in this up to t5.

my problem is that I can't convert the string value of last_computed_time and time _interval INTO TIME STAMP /DATE/TIME in this format.

and also addition of both of them.

Actually in java I can convert it using SimpleDateFormat and parsing method. but in ireport I am getting problem .

I need some thing like this

here the purpale line shows UCL(upper controll line) and blue line shows LCL(lower controll line).

here is some checking if value of t1/t2/t3/t4/t5 is sreater or smaller than UCL or LCL then the color of t1/t2/t3/t4/t5 will different. That I can do using customizer class.

I need to draw this two line associated with UCL and LCL along x-directionthis is very impotant. And other value measurement will be on y direction.

If you don't under stand my query please reply.

Please help me.

Any help would be greatly appreciated.

Thanks in advance. [file name=test-aa1036e8e0bb3b4b82231945ca0f6c33.doc size=39424]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/tes... size=159]

I am very new in iReport. i have learnt a lot from this forum.

Now I am trying to draw time series chart.

In my data base I have last_computed_time (String) ex=12:30 am Jan 2nd, 07, and time_interval as String and five values like t1(double),t2(double),t3(double),t4(double),t5(double).

here aome other cols like actual value ,UCL and LCL these are double.

Now I have to draw a time series chart where

value time

----- --------

t1 last_computed_time + time _interval

t2 last_computed_time + time _interval+ time _interval

t3 last_computed_time + time _interval+ time _interval+ time _interval

in this up to t5.

my problem is that I can't convert the string value of last_computed_time and time _interval INTO TIME STAMP /DATE/TIME in this format.

and also addition of both of them.

Actually in java I can convert it using SimpleDateFormat and parsing method. but in ireport I am getting problem .

I need some thing like this

here the purpale line shows UCL(upper controll line) and blue line shows LCL(lower controll line).

here is some checking if value of t1/t2/t3/t4/t5 is sreater or smaller than UCL or LCL then the color of t1/t2/t3/t4/t5 will different. That I can do using customizer class.

I need to draw this two line associated with UCL and LCL along x-directionthis is very impotant. And other value measurement will be on y direction.

If you don't under stand my query please reply.

Please help me.

Any help would be greatly appreciated.

Thanks in advance. [file name=test-aa1036e8e0bb3b4b82231945ca0f6c33.doc size=39424]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/tes... size=159]

## 2 Answers:

Posted on February 19, 2007 at 2:08pm

Hi,

If you know how to convert String to Date in Java using the SimpleDateFormat class, then it should be easy also in JasperReports as report expressions are Java expressions.

For each of the 5 T fields that you have you should create a corresponding V1, V2, ..., V5 variable of Date type. Each of these variables should have calculation="Nothing" and it their <variableExpression> should use a SimpleDataFormat to parse the Tx field into a Date value according to the known formatting pattern.

Once you have the 5 variables which hold the Date value for each of the 5 String T fields, you could feed them into a time series chart.

The way to add the time interval values to the initial time value, depends on what exactly the time interval String value represents. Is it a number of seconds or something similar? This is also a pure Java issue and not specific to JasperReports and iReport in particular. It is about working with date time values and you probably need to look into the Calendar class in JDK to see how such operations could be performed.

You then reuse these techniques in report variables to achieve what you need.

I hope this helps.

Teodor

If you know how to convert String to Date in Java using the SimpleDateFormat class, then it should be easy also in JasperReports as report expressions are Java expressions.

For each of the 5 T fields that you have you should create a corresponding V1, V2, ..., V5 variable of Date type. Each of these variables should have calculation="Nothing" and it their <variableExpression> should use a SimpleDataFormat to parse the Tx field into a Date value according to the known formatting pattern.

Once you have the 5 variables which hold the Date value for each of the 5 String T fields, you could feed them into a time series chart.

The way to add the time interval values to the initial time value, depends on what exactly the time interval String value represents. Is it a number of seconds or something similar? This is also a pure Java issue and not specific to JasperReports and iReport in particular. It is about working with date time values and you probably need to look into the Calendar class in JDK to see how such operations could be performed.

You then reuse these techniques in report variables to achieve what you need.

I hope this helps.

Teodor

Posted on February 20, 2007 at 4:48am

Hi

Very very thanks for your reply.

Actually now I can convert string to date datatype.

I have a problem with adding some date values. Here below what i have tried.

I have created a variable 'parse' with class type java.text.SimpleDateFormat and variable expression new SimpleDateFormat("HH:mm a MMM dd, yy") .

Then i created a variable 'dat' with class type java.util.Date and varible expression $V{parse}.parse($F{LAST_COMPUTED}) where $F{LAST_COMPUTED} is a field value (it's a string as example '12:30 am Jan 2nd, 07').

Now i can get this string as a date type varible in $V{dat}.

Now i want to add/subtruct some day/month/year/week or hour/minute/second with this $V{dat} varible and want to store in another varible .

The adding value may be 1 hour,2 hour, 1 weeks, 2 weeks, 3 months, 4 months in this way.

That i can't do in iReport.Please help me on that. Actually in java, using calender class(using add() and set() method) i can do it. But i want to calculate it in iReport(i am using Ver. 1.3.0).

Also in iReport I created another variavle 'calender'with class type java.util.Calendar and value expression Calendar.getInstance(). I know that it shows the current datetime value.. Actually i thought that using calender i can do it . But i am in vein.

If any one can't under stand my requirement please reply.

Please help me to short out this problem in iReport.

Thanks in advance.

Very very thanks for your reply.

Actually now I can convert string to date datatype.

I have a problem with adding some date values. Here below what i have tried.

I have created a variable 'parse' with class type java.text.SimpleDateFormat and variable expression new SimpleDateFormat("HH:mm a MMM dd, yy") .

Then i created a variable 'dat' with class type java.util.Date and varible expression $V{parse}.parse($F{LAST_COMPUTED}) where $F{LAST_COMPUTED} is a field value (it's a string as example '12:30 am Jan 2nd, 07').

Now i can get this string as a date type varible in $V{dat}.

Now i want to add/subtruct some day/month/year/week or hour/minute/second with this $V{dat} varible and want to store in another varible .

The adding value may be 1 hour,2 hour, 1 weeks, 2 weeks, 3 months, 4 months in this way.

That i can't do in iReport.Please help me on that. Actually in java, using calender class(using add() and set() method) i can do it. But i want to calculate it in iReport(i am using Ver. 1.3.0).

Also in iReport I created another variavle 'calender'with class type java.util.Calendar and value expression Calendar.getInstance(). I know that it shows the current datetime value.. Actually i thought that using calender i can do it . But i am in vein.

If any one can't under stand my requirement please reply.

Please help me to short out this problem in iReport.

Thanks in advance.