0
如何將可變數組中的值插入條形圖?使用可變數組的條形圖
#import "thirdViewController.h"
@interface thirdViewController()
{
PNBarChart * barChart;
}
@end
@implementation thirdViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.lblpass.text = [NSString stringWithFormat:@"%d",self.pass ];
self.lblfailed.text = [NSString stringWithFormat:@"%d",self.failed ];
[self getdata];
}
-(void)getdata
{
barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(self.view.frame.origin.x+10, self.view.frame.origin.y+300, SCREEN_WIDTH-50, 200.0)];
[barChart setXLabels:@[@"pass",@"Failed"]];
[barChart setYValues:@[@1, @2, @3, @4, @5]];
[barChart strokeChart];
[self.view addSubview:barChart];
}
我已經試過上面的代碼。
我會建議使用https://github.com/danielgindi/Charts它已經不僅僅是柱狀圖等各種圖表和支持是真棒。我已經在我的兩個項目中使用了它,並且似乎完美地工作。 – satheeshwaran