效果图:
工程图:
此代码需要加入第三方库NTChartView.
代码:
#import "RootViewController.h" //加入头文件 #import "NTChartView.h" - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title=@"竖状图"; NTChartView *v = [[NTChartView alloc] initWithFrame:CGRectMake(10, 10, 300, 300)]; NSArray *g = [NSArray arrayWithObject:[NSMutableArray arrayWithObjects: [NSNumber numberWithFloat:18], [NSNumber numberWithFloat:30], [NSNumber numberWithFloat:16.5], [NSNumber numberWithFloat:55], [NSNumber numberWithFloat:40],nil]]; v.groupData = g; [self.view addSubview:v]; }
时间: 2024-11-05 12:14:53