JYRadarChart 0.4.0

JYRadarChart 0.4.0

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2017年5月

Johnny Wu维护。



  • Johnny Wu

一个开源的iOS雷达图实现

截图

iPhone Screenshot1 iPhone Screenshot2 iPhone Screenshot3

需求

  • Xcode 5 或更高版本
  • iOS 5.0 或更高版本
  • ARC
  • CoreGraphics.framework

演示

在Xcode中构建和运行JYRadarChartDemo项目

安装

手动安装

您需要做的所有事情是将JYRadarChart文件放入您的项目中,并将#import "JYRadarChart.h"添加到将使用它的类的顶部。

用法示例

最小化定制

JYRadarChart *p = [[JYRadarChart alloc] initWithFrame:CGRectMake(30, 20, 200, 200)];
p.dataSeries = @[@[@(51),@(44),@(94),@(84),@(90)]];
p.attributes = @[@"attack",@"defense",@"speed",@"HP",@"MP"];
[self.view addSubview:p];

完全定制

JYRadarChart *p = [[JYRadarChart alloc] initWithFrame:CGRectMake(20, 20, 200, 200)];

NSArray *a1 = @[@(81), @(97), @(87), @(60), @(65), @(77)];
NSArray *a2 = @[@(91), @(87), @(33), @(77), @(78), @(96)];
//set the data series
p.dataSeries = @[a1, a2];
//how many "circles" in the chart 
p.steps = 4;
p.backgroundColor = [UIColor whiteColor];
//you can set radius, min and max value by yourself, but if you
//leave r (will fill the rect), minValue (will be 0), maxValue (default is 100) alone, 
//that is okay. the points with too big value will be out of the chart and thus invisible
p.r = 60;
p.minValue = 20;
p.maxValue = 120;
//you can choose whether fill area or not (just draw lines) 
p.fillArea = YES;
//you can specify the opacity, default is 1.0 (opaque)
p.colorOpacity = 0.7;
p.attributes = @[@"Attack", @"Defense", @"Speed", @"HP", @"MP", @"IQ"];
//if you do not need a legend, you can safely get rid of setTitles:
p.showLegend = YES;
[p setTitles:@[@"archer", @"footman"]];
//there is a color generator in the code, it will generate colors for you
//so if you do not want to specify the colors yourself, just delete the line below
[p setColors:@[[UIColor grayColor],[UIColor blackColor]]];
[self.view addSubview:p];

定制

以下是可以更改的所有属性,您可以在JYRadarChart.h中找到它们

@property (nonatomic, assign) CGFloat r;
@property (nonatomic, assign) CGFloat maxValue;
@property (nonatomic, assign) CGFloat minValue;
@property (nonatomic, assign) BOOL drawPoints;
@property (nonatomic, assign) BOOL fillArea;
@property (nonatomic, assign) BOOL showLegend;
@property (nonatomic, assign) BOOL showStepText;
@property (nonatomic, assign) CGFloat colorOpacity;
@property (nonatomic, copy) UIColor *backgroundLineColor;
@property (nonatomic, strong) NSArray *dataSeries;
@property (nonatomic, strong) NSArray *attributes;
@property (nonatomic, assign) NSUInteger steps;
@property (nonatomic, assign) CGPoint centerPoint;
- (void)setTitles:(NSArray *)titles;
- (void)setColors:(NSArray *)colors;

联系方式

johnny.wjy07#gmail.com

随时发送给我pull请求!

享受它~

许可证

JYRadarChart在MIT许可证下提供。

MIT许可证(MIT)

版权所有(c)2013 Johnny Wu

本协议特此授予,免费地向任何获得本软件及相关文档副本(以下简称“软件”)的个人,无限制地使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本的权利,并允许将软件提供给有权获得软件的个人进行上述操作,但需遵守以下条件:

在软件的所有副本或主要部分中必须包含上述版权声明和本授权声明。

软件按“现状”提供,不提供任何形式的明示或暗示保证,包括但不限于对适销性、适用于特定目的和无侵犯性的保证。在任何情况下,作者或版权所有者均不对任何索赔、损害或其它责任承担责任,无论此类责任源于合同行为、侵权行为或其他行为,不论此类责任源于使用软件或与软件相关或基于使用或操作软件。