I have two arrays arr1
and arr2
containing datetime in dd/MM/yyyy HH:mm:ss
and HH:mm:ss
respectively.
For eg. arr1[0]
contains 23/12/2011 09:15:30
while arr2[0]
contains 09:15:30
.
Note that arr1
will always contain today's date, which is exactly what I want for my iPad app which I'm preparing using Xcode 4.2.
I want to plot specific time (either from arr1
or from arr2
whichever is best suitable) on the X axis and corresponding float value contained in an array arr3
on Y-axis.
Now I'm stuck at plotting time on X axis as I can't pass time in dd/MM/yyyy HH:mm:ss
or HH:mm:ss
.
I googled about it and got the suggestion to use epoch
but I'm unable to implement it for my app.
Other than using epoch
, how can I pass a time value to Core Plot for the X axis?
Core Plot requires numeric plot data. You'll have to find a way to convert the dates to a number. One way is to convert each one to an epoch value as you mentioned. If the dates are not evenly spaced, that may be your only option.
If you know that the dates are spaced at regular intervals (e.g., hourly, daily, monthly, etc.) you could just figure an index that corresponds to each date. Make custom labels to display the dates and set the plot space range to cover the correct range of indices.