We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
Dates and times (Read 295 times)
Dates and times
Nov 29th, 2008, 12:08pm
 
Hello

I am developing an applet in Processing where I have want users to select columns from a dataset and plot them on a two dimensional graph.

As part of this, the users will be able to select only numeric columns but the datasets may include dates and times; for example, a user might want to plot a time series curve by hour of day.

Can anyone advise the best way for Processing to handle dates and times in this respect? Should they be converted to floats or integers for plotting and the actual dates or times be used as axis labels? Or is there another way?

Thanks

Martin O'Shea.
Re: Dates and times
Reply #1 - Nov 29th, 2008, 7:05pm
 
I am not too sure how to answer, because the request is a bit vague.
I would just say than in programming in general, and in Java in particular, coders use to represent time in two ways (at least): a count in milliseconds since a reference (start of 1970, when computer was started, when the sketch was started...) or a break down in seconds, minutes, hours, days, etc., either by independent numbers or in string format.

You can use the Time & Date functions provided by Processing (see Extended reference) and/or the Calendar API of Java.

I think that the axis should have real date/time labels, for humans, but you can have a regular progression in milliseconds (or higher).
Re: Dates and times
Reply #2 - Nov 29th, 2008, 8:54pm
 
PhilHo

Thanks for the answer.

An example of what I'm getting at is having a time-series plot with the calibrations on the X axis according tovalues for dates, times of day etc.

I'm concerned about the best way for Processing to handle date and time values though. Is it best to convert dates and times into numbers of seconds so that they can be used in a FloatTable as described in Ben Fry's book?

The axis calibrations would be in human-readable form and could easily form another column in the dataset. Although in my case, such columns would be hidden from the users on the web page or on the applet itself (preferred option) to prevent selection.

Does this clarify things?

Martin O'Shea.
Page Index Toggle Pages: 1