ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Trying to plot durations against time x-axis
Posted by Kev Thomas on Feb-12-2015 22:54
Hi,

I'm hoping someone can shed some light on a wee problem I have with trying to graph times/durations. My Java isn't too hot, and although I've managed to generate graphs in the past with ChartDirector, this is the first attempt at plotting times.


    TCHECKTIME TDURATION
1 07:00:00                 01/04/2015 00:00:41
2 09:00:00         01/04/2015 00:00:26
3 11:00:00         01/04/2015 00:00:44
4 13:00:00         01/04/2015 00:00:34
5 15:00:00         01/04/2015 00:00:44
6 17:00:00         01/04/2015 00:00:28

So, I have a query which returns the average duration across a number of times to get a duration (TDURATION), which is generally in the seconds, rather than minutes or hours.

I carry out the check at 7am, 9am, 11am etc as shown in the data above. My question is - how do I format the columns to be able to chart them? I would like to be able to present a bar chart with TCHECKTIME along the X Axis and TDURATION as the columns (and also the Y Axis). Preferably, the Y Axis will only show time information rather than date/time.

I'm using Java in a JSP page to generate the chart, so any advice would be greatly appreciated.

Cheers,
Kev

  Re: Trying to plot durations against time x-axis
Posted by Peter Kwan on Feb-13-2015 02:20
Hi Kev,

Since you mentioned "query", I assume the table in your message is a database table, and
you are using SQL to read it into Java. In this case, you can always write an SQL statement
that reads the time part of TDURATION as a number representing seconds. (There are many
SQL functions to manipulate date/time. The exact syntax depends on your database. Please
refer to your database documentation for details.) Once you obtain the data as numbers,
you can use them as the y-coordinate.

For the TCHECKTIME, you may consider to write an SQL to return text strings. In this way,
you can use them as x-axis labels.

In brief, for the charting code, you can use the same code as in the sample code. The only
thing you need to do is to obtain suitable data by using a suitable SQL query.

Hope this can help.

Regards
Peter Kwan

  Re: Trying to plot durations against time x-axis
Posted by Kev Thomas on Feb-17-2015 18:16
Hi Peter,

Many thanks once again for your invaluable support. I took your advice and looked again at what I was doing. I've managed to get things working as expected.

I appreciate all the time and effort you put in to helping others.

Keep up the fantastic work.

Cheers,
Kev