In my iPhone app I am implementing coreplot VerticalBar Chart
Though I am taking larger value for Y axis but it is displaying up to certain limit only. As shown in image, it is displaying bar up to N500000 only but actually I am passing larger value. (I am passing value through Graph Array given below).
What could be the problem?
Here is the image and code:
Here I am passing value for YRange
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-5000000) length:CPDecimalFromFloat(10000000)];
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(0.0f) length:CPDecimalFromFloat(21.0f)];
Code for generating Y axis labels:
CPXYAxis *y = axisSet.yAxis;
y.axisLineStyle =nil;
y.majorTickLineStyle = nil;
y.minorTickLineStyle = nil;
y.majorIntervalLength = CPDecimalFromString(@"2500000");
y.orthogonalCoordinateDecimal = CPDecimalFromString(@"0.0");
Here I am giving value of Tick mark Location
NSArray *marginArray =[NSArray arrayWithObjects:
[NSDecimalNumber numberWithInt:-5000000],
[NSDecimalNumber numberWithInt:-2500000],
[NSDecimalNumber numberWithInt:00],
[NSDecimalNumber numberWithInt:2500000],
[NSDecimalNumber numberWithInt:5000000],
[NSDecimalNumber numberWithInt:7500000],
[NSDecimalNumber numberWithInt:10000000],
nil];
Here I am giving Label Name:
y.labelingPolicy = CPAxisLabelingPolicyNone;
NSArray *yAxisLabels1 = [NSArray arrayWithObjects:@"-N5000000", @"-N2500000",@"N0",@"N2500000",@"N5000000", @"N7500000",@"N10000000", nil];
.
int labelLocation1;
labelLocation1 = 0;
NSMutableArray *custLabels1 = [NSMutableArray arrayWithCapacity:[yAxisLabels1 count]];
NSLog(@" %d",[yAxisLabels1 count]);
for (NSNumber *tickLocat1 in marginArray)
{
CPAxisLabel *newLabel1 = [[CPAxisLabel alloc] initWithText: [yAxisLabels1 objectAtIndex:labelLocation1++]
textStyle:y.labelTextStyle];
newLabel1.tickLocation = [tickLocat1 decimalValue];
newLabel1.offset = 3.0;//y.labelOffset;
[custLabels1 addObject:newLabel1];
[newLabel1 release];
}
y.axisLabels = [NSSet setWithArray:custLabels1];
y.majorTickLocations = [NSSet setWithArray:marginArray];
y.title = @"Y Axis";
y.titleOffset = 45.0f;
y.titleLocation = CPDecimalFromFloat(150.0f);
I am passing this Array for plotting graph:
NSArray *roiGraph = [NSArray arrayWithObjects:
[NSDecimalNumber numberWithInt:-5000000],
[NSDecimalNumber numberWithInt:5000],
[NSDecimalNumber numberWithInt:10000000],
[NSDecimalNumber numberWithInt:-5000000],
[NSDecimalNumber numberWithInt:9000000],
[NSDecimalNumber numberWithInt:20005],
[NSDecimalNumber numberWithInt:50000],
[NSDecimalNumber numberWithInt:7500000],
[NSDecimalNumber numberWithInt:400000],
[NSDecimalNumber numberWithInt:220000],
nil];
Look carefully to this line
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-5000000) length:CPDecimalFromFloat(10000000)];
You set length to 10 mln, and this mean that visible area is in (-5 mln to +5 mln). Setup length to other value, 15 mln for you example, and see results again.