Reputation: 917
I have been working on CorePlot.I have set the intervals between y-Axis but it look like Overlapping. Please check Screen shot below attached. Here is my code setting y-Axis in plot
CGFloat yMax=55;
CGFloat yMin=50;
CGFloat yInterval=0;
yInterval=(yMax-yMin)/4;
CPTXYAxis *y = axisSet.yAxis;
y.axisLineStyle = axisLineStyle;
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
[formatter setMaximumFractionDigits:0];
y.labelFormatter = formatter;
y.labelOffset = 2.0f;
y.labelAlignment = CPTAlignmentLeft;
y.labelTextStyle = axisTitleStyle;
y.tickDirection = CPTSignNegative;
y.majorTickLength = 3.0f;
y.majorIntervalLength = CPTDecimalFromDouble(yInterval);
y.majorGridLineStyle = gridLineStyle;
y.gridLinesRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(0) length:CPTDecimalFromInt(yMax)];
y.minorTicksPerInterval = 1;
y.minorTickLength = 2.0f;
y.orthogonalCoordinateDecimal = CPTDecimalFromDouble(0.0);
axisSet.xAxis.orthogonalCoordinateDecimal = CPTDecimalFromDouble(yMin-yInterval);
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0) length:CPTDecimalFromFloat(dateCount)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(yMin-yInterval) length:CPTDecimalFromFloat(yMax+yMin)];
please Guide me how give space between y-Axis points
Upvotes: 0
Views: 405
Reputation: 27381
The posted screenshot is correct. The space between tick marks on the y-axis (yInterval
) is (55 - 50) / 4 = 1.25. The yRange
has a location of 50 - 1.25 = 48.75 and length 50 + 55 = 105. That means you have tick marks every 1.25 units apart in a space of 105 units, or 84 ticks and labels.
Upvotes: 1