EasyCharts

EasyCharts

一个简单可方便快捷画出折线图、饼图、进度条、柱状图、雷达图的iOS库(Objective-C版本)。新库刚开始维护,希望大家多多支持,可issue、pull requestfind bugfeature request 。GitHub地址。

还有别忘了 star :-)

Features

  • BrokenLineChart (折线图)
  • PieChart (圆饼图)
  • ProgressChart (进度条)
  • BarGraph (柱状图->开发中)
  • RadarMap (雷达图->开发中)

持续更行中……

Installation

目前

  • 下载源代码,将EasyChartscopy进项目

Usage

导入头文件

#import "EasyCharts.h"

下面介绍一下几种图的基本使用

BrokenLineChart

BrokenLineChart目前有两种类型BrokenLineTypeCenterPointBrokenLineTypeNormal

BrokenLineTypeNormal是普通的折线图 \
BrokenLineTypeCenterPoint选中的点始终居中

创建时除了BrokenLineType还有两个参数,一个是frame,另一个是ECBrokenLineConfig(参数如下)对象。

ECBrokenLineConfig可配置折线图的属性,属性都有默认值。当然可以传nil,全部被使用默认值

@property (nonatomic, strong) UIColor *brokenLineColor;
@property (nonatomic, strong) UIColor *backVeiwLineColor;
@property (nonatomic, strong) UIColor *backVeiwTextColor;
@property (nonatomic, strong) UIColor *backVeiwBackGroupColor;
@property (nonatomic, strong) UIColor *brokenAbscissaColor;

@property (nonatomic, assign) CGFloat minValue;  //default 0
@property (nonatomic, assign) CGFloat maxValue;  //default 100

@property (nonatomic, assign) CGFloat numberOfIntervalLines; //default 5
@property (nonatomic, assign) BrokenLineType brokenLineType;

delegate,在当前折线图上的点被点击时调用:

- (void)brokenLineView:(ECBrokenLineView *)brokenLineView
   selectedAtIndexPath:(NSIndexPath *)indexPath;

初始化:

 ECBrokenLineView *brokenLineView = [ECBrokenLineView lineViewWithFrame:frame
                                                      withBrokenLineConfig:nil
                                                            brokenLineType:BrokenLineTypeNormal];
    brokenLineView.delegate = self;
    [self.view addSubview:brokenLineView];
 ECBrokenLineView *brokenLineView = [ECBrokenLineView lineViewWithFrame:frame
                                                      withBrokenLineConfig:nil
                                                            brokenLineType:BrokenLineTypeCenterPoint];
    brokenLineView.delegate = self;
    [self.view addSubview:brokenLineView];

填充数据(也可刷新页面数据)(数值小于最小值,则值显示为最小值,点两边为虚线。值大于最大值,则显示最大值,点两边为虚线):

[self.brokenLineView reloadLineViewDataWithPointValveList:self.pointValveList
                                                    titleText:self.pointTextList];

BrokenLineTypeNormal 效果图:



BrokenLineTypeCenterPoint 效果图:



ProgressView

初始化只需要传入frame

ECProgressChartView *progressView = [ECProgressChartView progressChartViewWithFrame:frame];
    [self.view addSubview:progressView];

填充数据(也可刷新页面数据);

[self.progressView resetProgress:[self createProgress]];

效果图:



BrokenLineChart && ProgressView

简单看一下应用场景:



PieChart

初始化只需要传入frame

 ECPieChartView *pieView = [ECPieChartView pieChartViewWithFrame:CGRectMake(0, 100, ECScreenW, 200)];
    [self.view addSubview:pieView];

填充数据(也可刷新页面数据);三个参数,分别是百分比列表、颜色列表、文案列表

[pieView drawPieChartWithPercentList:self.percentList
                               colorList:self.colorList
                             arcTextList:self.arcTextList];

效果图:



Communication

  • 如果在使用过程中遇到BUG,希望你能Issues我(最好提供复现步骤),谢谢
  • 如果在使用过程中发现功能不够用,希望你能Issues我
  • 如果你想为EasyCharts输出代码,请拼命Pull Requests

你可能感兴趣的:(移动,ios,ios,折线图,EasyCharts,饼图,雷达图)