Skip to content

Instantly share code, notes, and snippets.

@yuxiangq
Created March 4, 2016 16:44
Show Gist options
  • Save yuxiangq/2ff50e3cfd49c0568844 to your computer and use it in GitHub Desktop.
Save yuxiangq/2ff50e3cfd49c0568844 to your computer and use it in GitHub Desktop.
funnelChartViewDemo
#import "FunnelChart.h"
- (void)viewDidLoad {
[super viewDidLoad];
//初始化数据对象
FunnelChartModel *model1 = [FunnelChartModel new];
model1.value = 10.f;
model1.color = [UIColor redColor];
FunnelChartModel *model2 = [FunnelChartModel new];
model2.value = 12.f;
model2.color = [UIColor orangeColor];
FunnelChartModel *model3 = [FunnelChartModel new];
model3.value = 22.f;
model3.color = [UIColor brownColor];
FunnelChartModel *model4 = [FunnelChartModel new];
model4.value = 15.f;
model4.color = [UIColor yellowColor];
NSMutableArray *data = [NSMutableArray new];
[data addObject:model1];
[data addObject:model2];
[data addObject:model3];
[data addObject:model4];
//初始化控件方法
FunnelChartView *funnelChartView = [[FunnelChartView alloc]
initWithFrame:CGRectMake(0,
64,
CGRectGetWidth(self.view.frame),
CGRectGetHeight(self.view.frame) - 64.f)
funnelChartModelArray:data];
funnelChartView.didSelectedIndexFunnelChartBlock = ^(NSUInteger index){
NSLog(@"selected index %@",@(index));
};
[self.view addSubview:funnelChartView];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment