Jean
Jean

Reputation: 2625

Distance between x-axis ticks in core plot

Am breaking my head on this since yesterday (tried various attribute settings, goggled, stackoverflow'ed , et al,... in vain). At last, I decided to post this! I hope am not asking anything dumb! Please pardon me if so! :)

My Project Settings: Simple iPhone App that uses Core Plot, Xcode 4.2, iOS 5.0, Testing using iOS Simulator

My Question : I used the wonderful and DatePlot example from Core Plot site and am plotting (Scatter Plot) dates along the x-axis. am having two plots. It's all plotted fine (thanks to the simple example!); But the distance between each plot (along the x-axis) i.e. the distance between the major ticks is too small ... it's like this :

enter image description here

(Notice that the two red-colored ellipse-plots are so close to each other...that's the current distance between the ticks)

My Code Snippet (Relevant)

// Set up the axes CPTXYAxisSet *axisSet = (CPTXYAxisSet *) lineChart.axisSet;

CPTXYAxis *x                    = axisSet.xAxis;
NSTimeInterval oneDay   = 24.0 * 60.0 * 60.0;
x.majorIntervalLength           = CPTDecimalFromFloat(oneDay);
x.majorTickLength               = 1.0;
// Get a set of custom label for the X Axis
x.axisLabels                    = [self getXLabelSetForLineChart:x];
x.labelRotation                 = M_PI / 2;

NSDateFormatter *dateFormatter   = [[NSDateFormatter alloc] init];
dateFormatter.dateStyle          = kCFDateFormatterShortStyle;
[dateFormatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
CPTTimeFormatter *timeFormatter  = [[CPTTimeFormatter alloc] initWithDateFormatter:dateFormatter];
timeFormatter.referenceDate      = today;
x.labelFormatter                 = timeFormatter;
x.labelingPolicy                 = CPTAxisLabelingPolicyNone;

Can someone please help!!!

Thanks!

Upvotes: 1

Views: 1731

Answers (1)

Eric Skroch
Eric Skroch

Reputation: 27381

The length of the plot space xRange is too long. This compresses your data points into a smaller area and leaves unused spaces off to the right.

Upvotes: 4

Related Questions