0
votes

Hi in my iPhone App I am implementing coreplot VarticalBar Chart

Though I am taking Larger value For Y axis but It is displaying upto certain limit only as shown in image it is displaying bar upto N500000 only but Actually I am Passing Larger Value. (I am Passing value through Graph Array given below)

What could be the problem??

Please Help.

Here is the Image and code,

enter image description here

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 ploting 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];   
1

1 Answers

1
votes

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.