Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is some sample code taken from a recent project. My x-axis data was an array of NSDates. I set up my axisSet as normal, and then added the following code below:</p> <pre><code>axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyNone; NSMutableArray *countingXPoints=[[NSMutableArray alloc] init]; NSMutableArray *datesAsStrings=[[NSMutableArray alloc] init]; NSDateFormatter *df=[[NSDateFormatter alloc] init]; [df setDateFormat:@"MM-yy"]; for(int i=0; i&lt;[self.xAxisData count]; i++) { [countingXPoints addObject:[NSNumber numberWithInt:i]]; [datesAsStrings addObject:[df stringFromDate:[self.xAxisData objectAtIndex:i]]]; } NSArray *xCustomTickLocations = [NSArray arrayWithArray:(NSArray *)countingXPoints]; NSArray *xAxisLabels = [NSArray arrayWithArray:(NSArray *) datesAsStrings]; NSUInteger xLabelLocation = 0; NSMutableArray *xCustomLabels = [[NSMutableArray alloc] initWithCapacity:[xAxisLabels count]]; for (NSNumber *xTickLocation in xCustomTickLocations) { CPTAxisLabel *newXLabel = [[CPTAxisLabel alloc] initWithText: [xAxisLabels objectAtIndex:xLabelLocation++] textStyle:axisSet.xAxis.labelTextStyle]; newXLabel.tickLocation = [xTickLocation decimalValue]; newXLabel.offset = 0.0f; newXLabel.rotation = M_PI/4.0; [xCustomLabels addObject:newXLabel]; } axisSet.xAxis.axisLabels=[NSSet setWithArray:xCustomLabels]; </code></pre> <p>For the y-axis part of your question, you can adjust the tick intervals (attributes of CPTXYAxis). To achieve the correct axis height/length, take a look at the xRange, yRange, globalXRange, and globalYRance attributes of your plotspace.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload