Core-Plot: Incorrect x-axis date

Following various tutorials, I have successfully created a scatter plot using Core-Plot. Now, setting the dates on X-Axis, I get completely wrong dates. The source of my graph is an array containing a dictionary. In each dictionary entry, the first dictionary key is the unix timestamp, and the second is the value to draw. It looks like this:

    (
            {
        0 = 1334152500;
        1 = 0;
    },
            {
        0 = 1334152800;
        1 = 0;
    },
            {
        0 = 1334153100;
        1 = 0;
    },

AFAIK Core-Plot Start date and step required. In this case, the starting date is 1334152500 (Wed, Apr 11, 2012 13:55:00 GMT) and the step is 300 seconds. Every 300 seconds a new value is present. Now the code that I use to draw the X axis:

// this string contains the first UNIX Timestamp registered
NSString *tstamp_start = [NSString stringWithFormat:@"%@", [[[self.graphData  objectForKey:@"1"] objectAtIndex:0] objectForKey:@"0"]];
NSDate *refDate = [NSDate dateWithTimeIntervalSince1970:[tstamp_start doubleValue]];

// definition of the graph skipped...

CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet;
// tInterval is previous set to 300 - float.
// here I should set the Interval between every value on graph...
axisSet.xAxis.majorIntervalLength = CPTDecimalFromFloat(tInterval);
axisSet.xAxis.axisLineStyle = axisLineStyle;
axisSet.xAxis.majorTickLineStyle = axisLineStyle;
axisSet.xAxis.minorTickLineStyle = axisLineStyle;
axisSet.xAxis.labelTextStyle = textStyle;
axisSet.xAxis.labelOffset = 3.0f;
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd/MM/yyyy hh:mma"];
CPTTimeFormatter *timeFormatter = [[CPTTimeFormatter alloc] initWithDateFormatter:dateFormatter];
timeFormatter.referenceDate = refDate;
axisSet.xAxis.labelFormatter = timeFormatter;
axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromFloat(yAxisMin);
(...)

, X /, : '22/07/2054 06:35 AM '. 2054? (local +2, unix +0) CPTAxisLabelingPolicyAutomatic, , 13:55 . ?

!

+3
1

referenceDate - , . , . , , 0.

NSDate *refDate = [NSDate dateWithTimeIntervalSince1970:0.0];
+5

All Articles