アプリケーションでECGraphを使用しています。で定義されている(から継承された)メソッドをmyTopNameStr
動的に追加する必要があります。drawRect
DisplayView.m
UIView
NSArray
ECGraphViewController.m
- (void)drawRect:(CGRect)rect {
NSLog(@"==========%@",topPlace);
// Drawing code
CGContextRef _context = UIGraphicsGetCurrentContext();
ECGraph *graph = [[ECGraph alloc] initWithFrame:CGRectMake(0,0, 320, 480)
withContext:_context isPortrait:YES];
ECGraphItem *item1 = [[ECGraphItem alloc] init];
item1.isPercentage = YES;
item1.yValue = 71;
item1.width = 55;
item1.myTopNameStr = [topPlace objectAtIndex:0];
// item1.name = @"item1";
ECGraphItem *item2 = [[ECGraphItem alloc] init];
item2.isPercentage = YES;
item2.yValue = 61;
item2.width = 55;
// item2.myTopNameStr =[_topNameAry objectAtIndex:1];
//item2.name = @"item2";
ECGraphItem *item3 = [[ECGraphItem alloc] init];
item3.isPercentage = NO;
item3.yValue = 51;
item3.width = 55;
// item3.myTopNameStr =[_topNameAry objectAtIndex:2];
// item3.name = @"item3";
NSArray *items = [[NSArray alloc] initWithObjects:item1,item2,item3,nil];
// [graph setXaxisTitle:@"name"];
// [graph setYaxisTitle:@"Percentage"];
// [graph setGraphicTitle:@"Top Chat.Points"];
[graph setDelegate:self];
[graph setBackgroundColor:[UIColor whiteColor]];
[graph drawHistogramWithItems:items lineWidth:0 color:[UIColor clearColor]];
}