├── demonstrate.png ├── JJRadarChartSample.xcodeproj ├── xcuserdata │ └── siwei.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── JJRadarChartSample.xcscheme ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── siwei.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── project.pbxproj ├── JJRadarChartSample ├── ViewController.h ├── AppDelegate.h ├── main.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.storyboard ├── AppDelegate.m ├── ViewController.m └── JJRadarChart │ ├── JJRadarChart.h │ └── JJRadarChart.m └── README.md /demonstrate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean1992/JJRadarChart/HEAD/demonstrate.png -------------------------------------------------------------------------------- /JJRadarChartSample.xcodeproj/xcuserdata/siwei.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /JJRadarChartSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /JJRadarChartSample.xcodeproj/project.xcworkspace/xcuserdata/siwei.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Jean1992/JJRadarChart/HEAD/JJRadarChartSample.xcodeproj/project.xcworkspace/xcuserdata/siwei.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /JJRadarChartSample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // JJRadarChartSample 4 | // 5 | // Created by 四威 on 16/4/26. 6 | // Copyright © 2016年 JeanLeo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /JJRadarChartSample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // JJRadarChartSample 4 | // 5 | // Created by 四威 on 16/4/26. 6 | // Copyright © 2016年 JeanLeo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /JJRadarChartSample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // JJRadarChartSample 4 | // 5 | // Created by 四威 on 16/4/26. 6 | // Copyright © 2016年 JeanLeo. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /JJRadarChartSample.xcodeproj/xcuserdata/siwei.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | JJRadarChartSample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C93BC0851CCF416E00C266A9 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /JJRadarChartSample/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /JJRadarChartSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIFileSharingEnabled 6 | 7 | CFBundleDevelopmentRegion 8 | en 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /JJRadarChartSample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /JJRadarChartSample/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![demonstrate](https://github.com/JeanKit/JJRadarChart/blob/master/demonstrate.png) 2 | 3 | # 一款使用简单快捷的雷达图表控件, 继承于UIControl 4 | 5 | - 数据源方法dataSource (必须实现) 6 | 7 | 8 | 9 | 10 | - - 一共有多少数据 11 | 12 | 13 | 14 | 15 | - - - -(NSInteger)numberOfItemsInRadarChart:(JJRadarChart*)radarChart; 16 | 17 | 18 | 19 | 20 | - - 每组数据最大值 21 | 22 | 23 | 24 | 25 | - - - -(NSInteger)radarChart:(JJRadarChart*)radarChart maxCountAtIndex:(NSInteger)index; 26 | 27 | 28 | 29 | 30 | - - 每组数据当前数值 31 | 32 | 33 | 34 | 35 | - - - -(NSInteger)radarChart:(JJRadarChart*)radarChart rankAtIndex:(NSInteger)index; 36 | 37 | 38 | 39 | 40 | - - 每组数据标题 41 | 42 | 43 | 44 | 45 | - - - -(NSString*)radarChart:(JJRadarChart *)radarChart titleOfItemAtIndex:(NSInteger)index; 46 | 47 | 48 |   49 | 50 |   51 | 52 | - 代理方法delegate (可选) 53 | 54 | 55 | 56 | 57 | - - 正多边形的所有顶点 58 | 59 | 60 | 61 | 62 | - - - -(void)radarChart:(JJRadarChart*)radarChart didDisplayMaxPoint:(CGPoint)point atIndex:):(NSInteger)index; 63 | 64 | 65 | 66 | 67 | - - 每组数据当前数值所在的点 68 | 69 | 70 | 71 | 72 | - - - -(void)radarChart:(JJRadarChart*)radarChart didDisplayCurrentPoint:(CGPoint)point atIndex:(NSInteger)index; 73 | 74 | 75 | 76 | 77 | - - 点击每组数据的标题 78 | 79 | 80 | 81 | 82 | - - - -(void)radarChart:(JJRadarChart*)radarChart didSelectedItemAtIndex:(NSInteger)index; 83 | 84 | 85 | 86 | 87 | - Method对象方法 88 | 89 | 90 | 91 | 92 | - - 更新数据 93 | 94 | 95 | 96 | 97 | - - - -(void)reloadData; 98 | 99 | 100 | 101 | 102 | - - 取出序号对应的标题按钮 103 | 104 | 105 | 106 | 107 | - - - -(UIButton*)radarItemAtIndex:(NSInteger)index; 108 | 109 | 110 | 111 | 112 | - - 取出序号对应的值的百分比 113 | - - (CGFloat)percentageAtIndex:(NSInteger)index; 114 | 115 | 116 |   117 | 118 |   119 | 120 |   -------------------------------------------------------------------------------- /JJRadarChartSample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // JJRadarChartSample 4 | // 5 | // Created by 四威 on 16/4/26. 6 | // Copyright © 2016年 JeanLeo. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /JJRadarChartSample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // JJRadarChartSample 4 | // 5 | // Created by 四威 on 16/4/26. 6 | // Copyright © 2016年 JeanLeo. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "JJRadarChart.h" 11 | 12 | void msg(NSString *message) { 13 | [[[UIAlertView alloc] initWithTitle:@"提示" message:message delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil] show]; 14 | } 15 | 16 | @interface ViewController () { 17 | JJRadarChart *chart; 18 | } 19 | @end 20 | 21 | @implementation ViewController 22 | 23 | - (void)viewDidLoad { 24 | [super viewDidLoad]; 25 | //根据frame创建雷达图表 26 | chart = [[JJRadarChart alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.width)]; 27 | chart.center = CGPointMake(half(self.view.frame.size.width), half(self.view.frame.size.height)); 28 | //设置数据源 29 | chart.dataSource = self; 30 | //设置代理 31 | chart.delegate = self; 32 | //添加控件 33 | [self.view addSubview:chart]; 34 | 35 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(50, 50, 60, 30)]; 36 | [btn setTitle:@"刷新" forState:UIControlStateNormal]; 37 | btn.titleLabel.font = [UIFont systemFontOfSize:15]; 38 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; 39 | btn.backgroundColor = [UIColor orangeColor]; 40 | [btn addTarget:self action:sel_registerName("btnClick") forControlEvents:UIControlEventTouchUpInside]; 41 | [self.view addSubview:btn]; 42 | } 43 | - (void)btnClick { 44 | //刷新图表数据 45 | [chart reloadData]; 46 | } 47 | #pragma mark - JJRadarChartDataSource 48 | - (NSInteger)numberOfItemsInRadarChart:(JJRadarChart *)radarChart { 49 | //一共6组, 模拟 50 | return 6; 51 | } 52 | - (NSInteger)radarChart:(JJRadarChart *)radarChart maxCountAtIndex:(NSInteger)index { 53 | //每组最大100, 模拟 54 | return 100; 55 | } 56 | - (NSInteger)radarChart:(JJRadarChart *)radarChart rankAtIndex:(NSInteger)index { 57 | //随机数, 模拟数据 58 | NSInteger randNum = arc4random_uniform(94); 59 | return index + randNum; 60 | } 61 | - (NSString *)radarChart:(JJRadarChart *)radarChart titleOfItemAtIndex:(NSInteger)index { 62 | //模拟数据 63 | NSArray *arr = @[@"公交", @"食宿", @"日用", @"娱乐", @"购物", @"其他"]; 64 | return arr[index]; 65 | } 66 | #pragma mark - JJRadarChartDelegate 67 | - (void)radarChart:(JJRadarChart *)radarChart didDisplayCurrentPoint:(CGPoint)point atIndex:(NSInteger)index { 68 | // NSLog(@"当前%zd点在%@", index, NSStringFromCGPoint(point)); 69 | } 70 | - (void)radarChart:(JJRadarChart *)radarChart didDisplayMaxPoint:(CGPoint)point atIndex:(NSInteger)index { 71 | // NSLog(@"最大%zd点在%@", index, NSStringFromCGPoint(point)); 72 | } 73 | - (void)radarChart:(JJRadarChart *)radarChart didSelectedItemAtIndex:(NSInteger)index { 74 | //取出对应序号的item 75 | UIButton *btn = [radarChart radarItemAtIndex:index]; 76 | //取出对应序号当前数值百分比 77 | CGFloat percentage = [radarChart percentageAtIndex:index]; 78 | //取出对应序号的总数和当前数 79 | JJRadarChartRankInfo info = [radarChart rankInfoAtIndex:index]; 80 | //拼接字符串 81 | NSString *msgStr = [NSString stringWithFormat:@"最大%@为%zd, 当前%@为%zd, 占%.0f%%", btn.titleLabel.text, info.totalNumber, btn.titleLabel.text, info.currentNumber, percentage]; 82 | //弹窗显示 83 | msg(msgStr); 84 | } 85 | @end 86 | -------------------------------------------------------------------------------- /JJRadarChartSample/JJRadarChart/JJRadarChart.h: -------------------------------------------------------------------------------- 1 | // 2 | // JJRadarChart.h 3 | // JJRadarChartSample 4 | // 5 | // Created by 四威 on 16/4/26. 6 | // Copyright © 2016年 JeanLeo. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //总数与当前数结构体 12 | struct JJRadarChartRankInfo { 13 | NSInteger totalNumber; //总数 14 | NSInteger currentNumber; //当前数 15 | }; 16 | typedef struct JJRadarChartRankInfo JJRadarChartRankInfo; 17 | /** 18 | * 快速构造函数 19 | * 20 | * @param totalNumber 总数 21 | * @param currentNumber 当前数 22 | * 23 | * @return 结构体 24 | */ 25 | JJRadarChartRankInfo JJRadarChartRankInfoMake(NSInteger totalNumber, NSInteger currentNumber); 26 | 27 | @class JJRadarChart; 28 | /** 29 | * 数据源方法(必须实现) 30 | */ 31 | @protocol JJRadarChartDataSource 32 | @required 33 | /** 34 | * 一共多少组数据 35 | * 36 | * @param radarChart 控件本身 37 | * 38 | * @return 组数 39 | */ 40 | - (NSInteger)numberOfItemsInRadarChart:(JJRadarChart *)radarChart; 41 | /** 42 | * 某一组最大数值(整形) 43 | * 44 | * @param index 该组序号 45 | * @param radarChart 控件本身 46 | * 47 | * @return 数值 48 | */ 49 | - (NSInteger)radarChart:(JJRadarChart *)radarChart maxCountAtIndex:(NSInteger)index; 50 | /** 51 | * 某一组当前数值 52 | * 53 | * @param index 该组序号 54 | * @param radarChart 控件本身 55 | * 56 | * @return 数值 57 | */ 58 | - (NSInteger)radarChart:(JJRadarChart *)radarChart rankAtIndex:(NSInteger)index; 59 | /** 60 | * 某一组数据的标题 61 | * 62 | * @param radarChart 控件自身 63 | * @param index 该组序号 64 | * 65 | * @return 标题 66 | */ 67 | - (NSString *)radarChart:(JJRadarChart *)radarChart titleOfItemAtIndex:(NSInteger)index; 68 | @end 69 | 70 | /** 71 | * 代理方法(可选) 72 | */ 73 | @protocol JJRadarChartDelegate 74 | @optional 75 | /** 76 | * 正多边形的某一个顶点 77 | * 78 | * @param radarChart 控件本身 79 | * @param point 顶点值(CGPoint) 80 | * @param index 对应序号 81 | */ 82 | - (void)radarChart:(JJRadarChart *)radarChart didDisplayMaxPoint:(CGPoint)point atIndex:(NSInteger)index; 83 | /** 84 | * 某一组的当前数值所在点 85 | * 86 | * @param radarChart 控件本身 87 | * @param point 所在点点值(CGPoint) 88 | * @param index 对应序号 89 | */ 90 | - (void)radarChart:(JJRadarChart *)radarChart didDisplayCurrentPoint:(CGPoint)point atIndex:(NSInteger)index; 91 | /** 92 | * 某一组数据标题被选中 93 | * 94 | * @param radarChart 控件本身 95 | * @param index 对应序号 96 | */ 97 | - (void)radarChart:(JJRadarChart *)radarChart didSelectedItemAtIndex:(NSInteger)index; 98 | @end 99 | 100 | /** 101 | * 取半方法 102 | * 103 | * @param floatValue 浮点型 104 | * 105 | * @return 取半结果 106 | */ 107 | CGFloat half(CGFloat floatValue); 108 | /** 109 | * 根据rgb生成颜色 110 | * 111 | * @param r red 112 | * @param g green 113 | * @param b blue 114 | * 115 | * @return 结果颜色 116 | */ 117 | UIColor* colorRGB(CGFloat r, CGFloat g, CGFloat b); 118 | 119 | @interface JJRadarChart : UIControl 120 | 121 | //数据源属性 122 | @property (nonatomic, weak) iddataSource; 123 | //代理属性 124 | @property (nonatomic, weak) iddelegate; 125 | 126 | /** 127 | * 更新数据, 刷新视图 128 | */ 129 | - (void)reloadData; 130 | /** 131 | * 取出对应序号的item 132 | * 133 | * @param index 序号 134 | * 135 | * @return UIButton类型 136 | */ 137 | - (UIButton *)radarItemAtIndex:(NSInteger)index; 138 | /** 139 | * 取出对应序号的百分比值 140 | * 141 | * @param index 序号 142 | * 143 | * @return 数值 144 | */ 145 | - (CGFloat)percentageAtIndex:(NSInteger)index; 146 | 147 | - (JJRadarChartRankInfo)rankInfoAtIndex:(NSInteger)index; 148 | 149 | @end 150 | -------------------------------------------------------------------------------- /JJRadarChartSample.xcodeproj/xcuserdata/siwei.xcuserdatad/xcschemes/JJRadarChartSample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /JJRadarChartSample/JJRadarChart/JJRadarChart.m: -------------------------------------------------------------------------------- 1 | // 2 | // JJRadarChart.m 3 | // JJRadarChartSample 4 | // 5 | // Created by 四威 on 16/4/26. 6 | // Copyright © 2016年 JeanLeo. All rights reserved. 7 | // 8 | 9 | #import "JJRadarChart.h" 10 | 11 | 12 | JJRadarChartRankInfo JJRadarChartRankInfoMake(NSInteger totalNumber, NSInteger currentNumber) { 13 | JJRadarChartRankInfo info; 14 | info.totalNumber = totalNumber; 15 | info.currentNumber = currentNumber; 16 | return info; 17 | } 18 | CGFloat half(CGFloat floatValue) { 19 | return floatValue * 0.5; 20 | } 21 | UIColor* colorRGB(CGFloat r, CGFloat g, CGFloat b) { 22 | return [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1]; 23 | } 24 | 25 | #define c1 colorRGB(66,87,214) //样式随便搞, 赶着实现功能随便搞 26 | //#define c2 colorRGB(78,111,204) 27 | //#define c3 colorRGB(85,120,204) 28 | #define c2 colorRGB(105,136,207) 29 | //#define c5 colorRGB(115,147,218) 30 | #define c4 colorRGB(152,175,229) 31 | #define c3 colorRGB(180,200,245) 32 | 33 | @interface JJRadarChart () { 34 | NSInteger _itemsNumber; 35 | NSMutableArray *_arrayMaxCounts; 36 | NSMutableArray *_arrayRanks; 37 | CGFloat tWH; 38 | CGContextRef ctx; 39 | CGFloat maxRadius; 40 | } 41 | @end 42 | 43 | @implementation JJRadarChart 44 | 45 | #pragma mark - struct 46 | - (instancetype)init { 47 | if (self = [super init]) { 48 | [self initialize]; 49 | } 50 | return self; 51 | } 52 | - (id)initWithCoder:(NSCoder *)aDecoder { 53 | if (self = [super initWithCoder:aDecoder]) { 54 | [self initialize]; 55 | } 56 | return self; 57 | } 58 | - (instancetype)initWithFrame:(CGRect)frame { 59 | if ( self = [super initWithFrame:frame]) { 60 | [self initialize]; 61 | } 62 | return self; 63 | } 64 | - (void)initialize { 65 | self.backgroundColor = [UIColor clearColor]; 66 | } 67 | #pragma mark - setter 68 | - (void)setDataSource:(id)dataSource { 69 | _dataSource = dataSource; 70 | [self resetData]; 71 | } 72 | #pragma mark - superMethod 73 | 74 | - (void)drawRect:(CGRect)rect { 75 | CGContextRef context = UIGraphicsGetCurrentContext(); 76 | CGContextClearRect(context, rect); 77 | maxRadius = half(self.frame.size.height) * 0.6; 78 | tWH = half(self.frame.size.height) * 0.35; 79 | CGFloat margin = maxRadius / 3; 80 | CGFloat fixedMargin = margin; 81 | [self drawPolygonWithRadius:maxRadius color:c3 isMain:true]; 82 | [self drawPolygonWithRadius:maxRadius - margin color:c2 isMain:false]; 83 | margin += fixedMargin; 84 | [self drawPolygonWithRadius:maxRadius - margin color:c1 isMain:false]; 85 | // margin += fixedMargin; 86 | // [self drawPolygonWithRadius:maxRadius - margin color:c4]; 87 | // margin += fixedMargin; 88 | // [self drawPolygonWithRadius:maxRadius - margin color:c5]; 89 | // margin += fixedMargin; 90 | // [self drawPolygonWithRadius:maxRadius - margin color:c6]; 91 | // margin += fixedMargin; 92 | // [self drawPolygonWithRadius:maxRadius - margin color:c7]; 93 | 94 | [self drawLine]; 95 | } 96 | #pragma mark - function 97 | - (void)resetData { 98 | _arrayMaxCounts = [NSMutableArray array]; 99 | _arrayRanks = [NSMutableArray array]; 100 | _itemsNumber = 0; 101 | if ([_dataSource respondsToSelector:@selector(numberOfItemsInRadarChart:)]) { 102 | _itemsNumber = [_dataSource numberOfItemsInRadarChart:self]; 103 | } 104 | if ([_dataSource respondsToSelector:@selector(radarChart:maxCountAtIndex:)]) { 105 | for (NSInteger i = 0; i < _itemsNumber; i++) { 106 | NSNumber *maxCount = @([_dataSource radarChart:self maxCountAtIndex:i]); 107 | [_arrayMaxCounts addObject:maxCount]; 108 | } 109 | } 110 | if ([_dataSource respondsToSelector:@selector(radarChart:rankAtIndex:)]) { 111 | for (NSInteger i = 0; i < _itemsNumber; i++) { 112 | NSNumber *rank = @([_dataSource radarChart:self rankAtIndex:i]); 113 | [_arrayRanks addObject:rank]; 114 | } 115 | } 116 | } 117 | - (void)reloadData { 118 | [self resetData]; 119 | [self setNeedsDisplay]; 120 | } 121 | 122 | - (void)drawPolygonWithRadius:(CGFloat)radius color:(UIColor *)color isMain:(BOOL)isMain{ 123 | //获取上下文 124 | NSInteger num = _itemsNumber; 125 | CGFloat x = half(self.frame.size.width); 126 | CGFloat y = half(self.frame.size.height); 127 | ctx = UIGraphicsGetCurrentContext(); 128 | [color setFill]; 129 | CGContextSetLineWidth(ctx, 2); 130 | CGContextMoveToPoint(ctx, x + radius, y); 131 | NSMutableArray *topPionts = [NSMutableArray array]; 132 | for (NSInteger i = 1; i <= num; i++) { 133 | //计算顶点的位置 134 | CGPoint point = CGPointMake(x + radius * cos( 2 * M_PI * i / num), y + radius * sin(2 * M_PI * i / num)); 135 | [topPionts addObject:[NSValue valueWithCGPoint:point]]; 136 | if (isMain) { 137 | if ([self.delegate respondsToSelector:@selector(radarChart:didDisplayMaxPoint:atIndex:)]) { 138 | [self.delegate radarChart:self didDisplayMaxPoint:point atIndex:i - 1]; 139 | } 140 | //演示用, 不喜欢可以去掉 141 | // UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; 142 | // lbl.layer.cornerRadius = half(lbl.frame.size.width); 143 | // lbl.layer.masksToBounds = true; 144 | // lbl.backgroundColor = [UIColor orangeColor]; 145 | // lbl.textColor = [UIColor whiteColor]; 146 | // lbl.center = point; 147 | // lbl.text = [NSString stringWithFormat:@"%zd", i - 1]; 148 | // lbl.textAlignment = NSTextAlignmentCenter; 149 | // [self addSubview:lbl]; 150 | } 151 | //连线 152 | CGContextAddLineToPoint(ctx, point.x, point.y); 153 | } 154 | CGContextFillPath(ctx); 155 | NSMutableArray *itemCenters = [NSMutableArray array]; 156 | for (NSInteger i = 0; i < topPionts.count; i++) { 157 | ctx = UIGraphicsGetCurrentContext(); 158 | [c4 setStroke]; 159 | CGContextSetLineWidth(ctx, 2); 160 | CGContextMoveToPoint(ctx, x, y); 161 | NSValue *vPoint = topPionts[i]; 162 | CGPoint point = vPoint.CGPointValue; 163 | CGPoint itemCenter; 164 | if (isMain) { 165 | if (point.x == x && point.y == y - maxRadius) {//正上方 166 | itemCenter = CGPointMake(point.x, point.y - half(tWH)); 167 | }else if (point.x == x && point.y == y + maxRadius) {//正下方 168 | itemCenter = CGPointMake(point.x, point.y + half(tWH)); 169 | }else if (point.y == y && point.x == x - maxRadius) {//正左方 170 | itemCenter = CGPointMake(point.x - half(tWH), point.y); 171 | }else if (point.y == y && point.x == x + maxRadius) {//正右方 172 | itemCenter = CGPointMake(point.x + half(tWH), point.y); 173 | }else if (point.x < x && point.x > x - maxRadius && point.y < y && point.y > y - maxRadius) {//左上 174 | itemCenter = CGPointMake(point.x - half(tWH), point.y - half(tWH)); 175 | }else if (point.x > x && point.x < x + maxRadius && point.y < y && point.y > y - maxRadius) {//右上 176 | itemCenter = CGPointMake(point.x + half(tWH), point.y - half(tWH)); 177 | }else if (point.x < x && point.x > x - maxRadius && point.y > y && point.y < y + maxRadius) {//左下 178 | itemCenter = CGPointMake(point.x - half(tWH), point.y + half(tWH)); 179 | }else if (point.x > x && point.x < x + maxRadius && point.y > y && point.y < y + maxRadius) {//右下 180 | itemCenter = CGPointMake(point.x + half(tWH), point.y + half(tWH)); 181 | }else { 182 | itemCenter = CGPointMake(point.x + half(tWH), point.y - half(tWH)); 183 | } 184 | [itemCenters addObject:[NSValue valueWithCGPoint:itemCenter]]; 185 | } 186 | CGContextAddLineToPoint(ctx, point.x, point.y); 187 | CGContextStrokePath(ctx); 188 | } 189 | 190 | for (NSInteger i = 0; i < itemCenters.count; i++) { 191 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, tWH, tWH)]; 192 | btn.tag = 200 + i; 193 | NSValue *pValue = itemCenters[i]; 194 | CGPoint bCenter = pValue.CGPointValue; 195 | btn.center = bCenter; 196 | [btn setBackgroundColor:[UIColor clearColor]]; 197 | [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 198 | if ([_dataSource respondsToSelector:@selector(radarChart:titleOfItemAtIndex:)]) { 199 | [btn setTitle:[_dataSource radarChart:self titleOfItemAtIndex:i] forState:UIControlStateNormal]; 200 | } 201 | [btn.titleLabel setFont:[UIFont systemFontOfSize:16 weight:UIFontWeightBold]]; 202 | [self addSubview:btn]; 203 | [btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside]; 204 | } 205 | } 206 | - (void)btnClick:(UIButton *)btn { 207 | if ([_delegate respondsToSelector:@selector(radarChart:didSelectedItemAtIndex:)]) { 208 | [_delegate radarChart:self didSelectedItemAtIndex:btn.tag - 200]; 209 | } 210 | } 211 | - (void)drawLine { 212 | CGFloat radius; 213 | NSInteger num = _itemsNumber; 214 | CGFloat x = half(self.frame.size.width); 215 | CGFloat y = half(self.frame.size.height); 216 | ctx = UIGraphicsGetCurrentContext(); 217 | [colorRGB(255, 200, 0) setFill]; 218 | CGContextSetAlpha(ctx, 0.6); 219 | CGContextSetLineWidth(ctx, 3); 220 | radius = maxRadius / ((NSNumber *)_arrayMaxCounts.lastObject).integerValue * ((NSNumber *)_arrayRanks.lastObject).integerValue; 221 | CGContextMoveToPoint(ctx, x + radius, y); 222 | for (NSInteger i = 1; i <= num; i++) { 223 | radius = maxRadius / ((NSNumber *)_arrayMaxCounts[i - 1]).integerValue * ((NSNumber *)_arrayRanks[i - 1]).integerValue; 224 | //计算当前点的位置 225 | CGPoint point = CGPointMake(x + radius * cos( 2 * M_PI * i / num), y + radius * sin(2 * M_PI * i / num)); 226 | if ([self.delegate respondsToSelector:@selector(radarChart:didDisplayCurrentPoint:atIndex:)]) { 227 | [self.delegate radarChart:self didDisplayCurrentPoint:point atIndex:i - 1]; 228 | } 229 | //连线 230 | CGContextAddLineToPoint(ctx, point.x, point.y); 231 | } 232 | CGContextFillPath(ctx); 233 | 234 | // ctx = UIGraphicsGetCurrentContext(); 235 | // [colorRGB(255, 178, 0) setStroke]; 236 | // CGContextSetLineWidth(ctx, 3); 237 | // radius = maxRadius / ((NSNumber *)_arrayMaxCounts.lastObject).integerValue * ((NSNumber *)_arrayRanks.lastObject).integerValue; 238 | // CGContextMoveToPoint(ctx, x + radius, y); 239 | // for (NSInteger i = 1; i <= num; i++) { 240 | // radius = maxRadius / ((NSNumber *)_arrayMaxCounts[i - 1]).integerValue * ((NSNumber *)_arrayRanks[i - 1]).integerValue; 241 | // //计算当前点的位置 242 | // CGPoint point = CGPointMake(x + radius * cos( 2 * M_PI * i / num), y + radius * sin(2 * M_PI * i / num)); 243 | // //连线 244 | // CGContextAddLineToPoint(ctx, point.x, point.y); 245 | // } 246 | // CGContextStrokePath(ctx); 247 | } 248 | - (UIButton *)radarItemAtIndex:(NSInteger)index { 249 | UIButton *btn = (UIButton *)[self viewWithTag:200 + index]; 250 | return btn; 251 | } 252 | - (CGFloat)percentageAtIndex:(NSInteger)index { 253 | NSNumber *max = _arrayMaxCounts[index]; 254 | NSNumber *cur = _arrayRanks[index]; 255 | CGFloat maxF = max.floatValue, curF = cur.floatValue; 256 | CGFloat percentage = curF / maxF * 100; 257 | return percentage; 258 | } 259 | - (JJRadarChartRankInfo)rankInfoAtIndex:(NSInteger)index { 260 | NSInteger total = ((NSNumber *)_arrayMaxCounts[index]).integerValue; 261 | NSInteger current = ((NSNumber *)_arrayRanks[index]).integerValue; 262 | return JJRadarChartRankInfoMake(total, current); 263 | } 264 | @end 265 | -------------------------------------------------------------------------------- /JJRadarChartSample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C93BC08B1CCF416E00C266A9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C93BC08A1CCF416E00C266A9 /* main.m */; }; 11 | C93BC08E1CCF416E00C266A9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C93BC08D1CCF416E00C266A9 /* AppDelegate.m */; }; 12 | C93BC0911CCF416E00C266A9 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C93BC0901CCF416E00C266A9 /* ViewController.m */; }; 13 | C93BC0941CCF416E00C266A9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C93BC0921CCF416E00C266A9 /* Main.storyboard */; }; 14 | C93BC0961CCF416E00C266A9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C93BC0951CCF416E00C266A9 /* Assets.xcassets */; }; 15 | C93BC0991CCF416E00C266A9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C93BC0971CCF416E00C266A9 /* LaunchScreen.storyboard */; }; 16 | C93BC0A21CCF41A800C266A9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C93BC0A11CCF41A800C266A9 /* CoreGraphics.framework */; }; 17 | C93BC0A61CCF438900C266A9 /* JJRadarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C93BC0A51CCF438900C266A9 /* JJRadarChart.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | C93BC0861CCF416E00C266A9 /* JJRadarChartSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JJRadarChartSample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | C93BC08A1CCF416E00C266A9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 23 | C93BC08C1CCF416E00C266A9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 24 | C93BC08D1CCF416E00C266A9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 25 | C93BC08F1CCF416E00C266A9 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 26 | C93BC0901CCF416E00C266A9 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 27 | C93BC0931CCF416E00C266A9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 28 | C93BC0951CCF416E00C266A9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 29 | C93BC0981CCF416E00C266A9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 30 | C93BC09A1CCF416E00C266A9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31 | C93BC0A11CCF41A800C266A9 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 32 | C93BC0A41CCF438900C266A9 /* JJRadarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JJRadarChart.h; sourceTree = ""; }; 33 | C93BC0A51CCF438900C266A9 /* JJRadarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JJRadarChart.m; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | C93BC0831CCF416E00C266A9 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | C93BC0A21CCF41A800C266A9 /* CoreGraphics.framework in Frameworks */, 42 | ); 43 | runOnlyForDeploymentPostprocessing = 0; 44 | }; 45 | /* End PBXFrameworksBuildPhase section */ 46 | 47 | /* Begin PBXGroup section */ 48 | C93BC07D1CCF416E00C266A9 = { 49 | isa = PBXGroup; 50 | children = ( 51 | C93BC0881CCF416E00C266A9 /* JJRadarChartSample */, 52 | C93BC0871CCF416E00C266A9 /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | C93BC0871CCF416E00C266A9 /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | C93BC0861CCF416E00C266A9 /* JJRadarChartSample.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | C93BC0881CCF416E00C266A9 /* JJRadarChartSample */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | C93BC0A31CCF41BE00C266A9 /* Frameworks */, 68 | C93BC0A01CCF419700C266A9 /* JJRadarChart */, 69 | C93BC08C1CCF416E00C266A9 /* AppDelegate.h */, 70 | C93BC08D1CCF416E00C266A9 /* AppDelegate.m */, 71 | C93BC08F1CCF416E00C266A9 /* ViewController.h */, 72 | C93BC0901CCF416E00C266A9 /* ViewController.m */, 73 | C93BC0921CCF416E00C266A9 /* Main.storyboard */, 74 | C93BC0951CCF416E00C266A9 /* Assets.xcassets */, 75 | C93BC0971CCF416E00C266A9 /* LaunchScreen.storyboard */, 76 | C93BC09A1CCF416E00C266A9 /* Info.plist */, 77 | C93BC0891CCF416E00C266A9 /* Supporting Files */, 78 | ); 79 | path = JJRadarChartSample; 80 | sourceTree = ""; 81 | }; 82 | C93BC0891CCF416E00C266A9 /* Supporting Files */ = { 83 | isa = PBXGroup; 84 | children = ( 85 | C93BC08A1CCF416E00C266A9 /* main.m */, 86 | ); 87 | name = "Supporting Files"; 88 | sourceTree = ""; 89 | }; 90 | C93BC0A01CCF419700C266A9 /* JJRadarChart */ = { 91 | isa = PBXGroup; 92 | children = ( 93 | C93BC0A41CCF438900C266A9 /* JJRadarChart.h */, 94 | C93BC0A51CCF438900C266A9 /* JJRadarChart.m */, 95 | ); 96 | path = JJRadarChart; 97 | sourceTree = ""; 98 | }; 99 | C93BC0A31CCF41BE00C266A9 /* Frameworks */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | C93BC0A11CCF41A800C266A9 /* CoreGraphics.framework */, 103 | ); 104 | path = Frameworks; 105 | sourceTree = ""; 106 | }; 107 | /* End PBXGroup section */ 108 | 109 | /* Begin PBXNativeTarget section */ 110 | C93BC0851CCF416E00C266A9 /* JJRadarChartSample */ = { 111 | isa = PBXNativeTarget; 112 | buildConfigurationList = C93BC09D1CCF416E00C266A9 /* Build configuration list for PBXNativeTarget "JJRadarChartSample" */; 113 | buildPhases = ( 114 | C93BC0821CCF416E00C266A9 /* Sources */, 115 | C93BC0831CCF416E00C266A9 /* Frameworks */, 116 | C93BC0841CCF416E00C266A9 /* Resources */, 117 | ); 118 | buildRules = ( 119 | ); 120 | dependencies = ( 121 | ); 122 | name = JJRadarChartSample; 123 | productName = JJRadarChartSample; 124 | productReference = C93BC0861CCF416E00C266A9 /* JJRadarChartSample.app */; 125 | productType = "com.apple.product-type.application"; 126 | }; 127 | /* End PBXNativeTarget section */ 128 | 129 | /* Begin PBXProject section */ 130 | C93BC07E1CCF416E00C266A9 /* Project object */ = { 131 | isa = PBXProject; 132 | attributes = { 133 | LastUpgradeCheck = 0730; 134 | ORGANIZATIONNAME = JeanLeo; 135 | TargetAttributes = { 136 | C93BC0851CCF416E00C266A9 = { 137 | CreatedOnToolsVersion = 7.3; 138 | }; 139 | }; 140 | }; 141 | buildConfigurationList = C93BC0811CCF416E00C266A9 /* Build configuration list for PBXProject "JJRadarChartSample" */; 142 | compatibilityVersion = "Xcode 3.2"; 143 | developmentRegion = English; 144 | hasScannedForEncodings = 0; 145 | knownRegions = ( 146 | en, 147 | Base, 148 | ); 149 | mainGroup = C93BC07D1CCF416E00C266A9; 150 | productRefGroup = C93BC0871CCF416E00C266A9 /* Products */; 151 | projectDirPath = ""; 152 | projectRoot = ""; 153 | targets = ( 154 | C93BC0851CCF416E00C266A9 /* JJRadarChartSample */, 155 | ); 156 | }; 157 | /* End PBXProject section */ 158 | 159 | /* Begin PBXResourcesBuildPhase section */ 160 | C93BC0841CCF416E00C266A9 /* Resources */ = { 161 | isa = PBXResourcesBuildPhase; 162 | buildActionMask = 2147483647; 163 | files = ( 164 | C93BC0991CCF416E00C266A9 /* LaunchScreen.storyboard in Resources */, 165 | C93BC0961CCF416E00C266A9 /* Assets.xcassets in Resources */, 166 | C93BC0941CCF416E00C266A9 /* Main.storyboard in Resources */, 167 | ); 168 | runOnlyForDeploymentPostprocessing = 0; 169 | }; 170 | /* End PBXResourcesBuildPhase section */ 171 | 172 | /* Begin PBXSourcesBuildPhase section */ 173 | C93BC0821CCF416E00C266A9 /* Sources */ = { 174 | isa = PBXSourcesBuildPhase; 175 | buildActionMask = 2147483647; 176 | files = ( 177 | C93BC0911CCF416E00C266A9 /* ViewController.m in Sources */, 178 | C93BC0A61CCF438900C266A9 /* JJRadarChart.m in Sources */, 179 | C93BC08E1CCF416E00C266A9 /* AppDelegate.m in Sources */, 180 | C93BC08B1CCF416E00C266A9 /* main.m in Sources */, 181 | ); 182 | runOnlyForDeploymentPostprocessing = 0; 183 | }; 184 | /* End PBXSourcesBuildPhase section */ 185 | 186 | /* Begin PBXVariantGroup section */ 187 | C93BC0921CCF416E00C266A9 /* Main.storyboard */ = { 188 | isa = PBXVariantGroup; 189 | children = ( 190 | C93BC0931CCF416E00C266A9 /* Base */, 191 | ); 192 | name = Main.storyboard; 193 | sourceTree = ""; 194 | }; 195 | C93BC0971CCF416E00C266A9 /* LaunchScreen.storyboard */ = { 196 | isa = PBXVariantGroup; 197 | children = ( 198 | C93BC0981CCF416E00C266A9 /* Base */, 199 | ); 200 | name = LaunchScreen.storyboard; 201 | sourceTree = ""; 202 | }; 203 | /* End PBXVariantGroup section */ 204 | 205 | /* Begin XCBuildConfiguration section */ 206 | C93BC09B1CCF416E00C266A9 /* Debug */ = { 207 | isa = XCBuildConfiguration; 208 | buildSettings = { 209 | ALWAYS_SEARCH_USER_PATHS = NO; 210 | CLANG_ANALYZER_NONNULL = YES; 211 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 212 | CLANG_CXX_LIBRARY = "libc++"; 213 | CLANG_ENABLE_MODULES = YES; 214 | CLANG_ENABLE_OBJC_ARC = YES; 215 | CLANG_WARN_BOOL_CONVERSION = YES; 216 | CLANG_WARN_CONSTANT_CONVERSION = YES; 217 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 218 | CLANG_WARN_EMPTY_BODY = YES; 219 | CLANG_WARN_ENUM_CONVERSION = YES; 220 | CLANG_WARN_INT_CONVERSION = YES; 221 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 222 | CLANG_WARN_UNREACHABLE_CODE = YES; 223 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 224 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 225 | COPY_PHASE_STRIP = NO; 226 | DEBUG_INFORMATION_FORMAT = dwarf; 227 | ENABLE_STRICT_OBJC_MSGSEND = YES; 228 | ENABLE_TESTABILITY = YES; 229 | GCC_C_LANGUAGE_STANDARD = gnu99; 230 | GCC_DYNAMIC_NO_PIC = NO; 231 | GCC_NO_COMMON_BLOCKS = YES; 232 | GCC_OPTIMIZATION_LEVEL = 0; 233 | GCC_PREPROCESSOR_DEFINITIONS = ( 234 | "DEBUG=1", 235 | "$(inherited)", 236 | ); 237 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 238 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 239 | GCC_WARN_UNDECLARED_SELECTOR = YES; 240 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 241 | GCC_WARN_UNUSED_FUNCTION = YES; 242 | GCC_WARN_UNUSED_VARIABLE = YES; 243 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 244 | MTL_ENABLE_DEBUG_INFO = YES; 245 | ONLY_ACTIVE_ARCH = YES; 246 | SDKROOT = iphoneos; 247 | }; 248 | name = Debug; 249 | }; 250 | C93BC09C1CCF416E00C266A9 /* Release */ = { 251 | isa = XCBuildConfiguration; 252 | buildSettings = { 253 | ALWAYS_SEARCH_USER_PATHS = NO; 254 | CLANG_ANALYZER_NONNULL = YES; 255 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 256 | CLANG_CXX_LIBRARY = "libc++"; 257 | CLANG_ENABLE_MODULES = YES; 258 | CLANG_ENABLE_OBJC_ARC = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_CONSTANT_CONVERSION = YES; 261 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 262 | CLANG_WARN_EMPTY_BODY = YES; 263 | CLANG_WARN_ENUM_CONVERSION = YES; 264 | CLANG_WARN_INT_CONVERSION = YES; 265 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 266 | CLANG_WARN_UNREACHABLE_CODE = YES; 267 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 268 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 269 | COPY_PHASE_STRIP = NO; 270 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 271 | ENABLE_NS_ASSERTIONS = NO; 272 | ENABLE_STRICT_OBJC_MSGSEND = YES; 273 | GCC_C_LANGUAGE_STANDARD = gnu99; 274 | GCC_NO_COMMON_BLOCKS = YES; 275 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 276 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 277 | GCC_WARN_UNDECLARED_SELECTOR = YES; 278 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 279 | GCC_WARN_UNUSED_FUNCTION = YES; 280 | GCC_WARN_UNUSED_VARIABLE = YES; 281 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 282 | MTL_ENABLE_DEBUG_INFO = NO; 283 | SDKROOT = iphoneos; 284 | VALIDATE_PRODUCT = YES; 285 | }; 286 | name = Release; 287 | }; 288 | C93BC09E1CCF416E00C266A9 /* Debug */ = { 289 | isa = XCBuildConfiguration; 290 | buildSettings = { 291 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 292 | INFOPLIST_FILE = JJRadarChartSample/Info.plist; 293 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 294 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 295 | PRODUCT_BUNDLE_IDENTIFIER = com.kit.jean.JJRadarChartSample; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | }; 298 | name = Debug; 299 | }; 300 | C93BC09F1CCF416E00C266A9 /* Release */ = { 301 | isa = XCBuildConfiguration; 302 | buildSettings = { 303 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 304 | INFOPLIST_FILE = JJRadarChartSample/Info.plist; 305 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 306 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 307 | PRODUCT_BUNDLE_IDENTIFIER = com.kit.jean.JJRadarChartSample; 308 | PRODUCT_NAME = "$(TARGET_NAME)"; 309 | }; 310 | name = Release; 311 | }; 312 | /* End XCBuildConfiguration section */ 313 | 314 | /* Begin XCConfigurationList section */ 315 | C93BC0811CCF416E00C266A9 /* Build configuration list for PBXProject "JJRadarChartSample" */ = { 316 | isa = XCConfigurationList; 317 | buildConfigurations = ( 318 | C93BC09B1CCF416E00C266A9 /* Debug */, 319 | C93BC09C1CCF416E00C266A9 /* Release */, 320 | ); 321 | defaultConfigurationIsVisible = 0; 322 | defaultConfigurationName = Release; 323 | }; 324 | C93BC09D1CCF416E00C266A9 /* Build configuration list for PBXNativeTarget "JJRadarChartSample" */ = { 325 | isa = XCConfigurationList; 326 | buildConfigurations = ( 327 | C93BC09E1CCF416E00C266A9 /* Debug */, 328 | C93BC09F1CCF416E00C266A9 /* Release */, 329 | ); 330 | defaultConfigurationIsVisible = 0; 331 | defaultConfigurationName = Release; 332 | }; 333 | /* End XCConfigurationList section */ 334 | }; 335 | rootObject = C93BC07E1CCF416E00C266A9 /* Project object */; 336 | } 337 | --------------------------------------------------------------------------------