Reputation: 6532
I am Generate Scatter Plot below code:
- (void)viewDidLoad
{
[super viewDidLoad];
[self generateDataSamples];
CPTGraphHostingView *hostingview=[[CPTGraphHostingView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:hostingview];
graph=[[CPTXYGraph alloc] initWithFrame:self.view.bounds];
hostingview.hostedGraph =graph;
CPTScatterPlot *datasourceLinePlot =[[CPTScatterPlot alloc] init];
datasourceLinePlot.dataSource =self;
[graph addPlot:datasourceLinePlot];
[datasourceLinePlot release];
[graph release];
[hostingview release];
}
Output is Below:
But,I need display majorline and minorline for x and yaxis...!
like this y-0.5,1.0,1.5....! and x-0.5,1.0,1.5...!
I want to output below image:
any one help with me....!
Thanks...!
Upvotes: 1
Views: 310
Reputation: 7644
You just need to set major and minor tick information (sample shown below for x-axis):
CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle];
lineStyle.lineColor = [CPTColor blackColor];
lineStyle.lineWidth = 2.0f;
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
axisSet.xAxis.axisLineStyle = lineStyle;
axisSet.xAxis.majorTickLineStyle = lineStyle;
axisSet.xAxis.minorTickLineStyle = lineStyle;
axisSet.xAxis.majorIntervalLength = CPTDecimalFromString(@"5");
axisSet.xAxis.majorTickLength = 7.0f;
axisSet.xAxis.majorTickLength = 7.0f;
Upvotes: 1