Skip to content

A simple chart lib used for iOS(Objective-c && Swift). :-)

Notifications You must be signed in to change notification settings

foolsong/EasyCharts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EasyCharts EC_logo

A simple chart lib used for iOS(Objective-c). :-) Swift

中文说明

Requirements

  • ARC
  • iOS>=8.0
  • iPhone || iPad
  • Xcode 8.0 or later

Features

  • BrokenLineChart
  • PieChart
  • ProgressChart
  • BarGraph
  • RadarMap

Continuously updating ...…

Installation

At present

  • by cloning the project into your repository

Usage

Import header file

#import "EasyCharts.h"

The following describes the basic use of several graphs.

BrokenLineChart

BrokenLineChart now includes :BrokenLineTypeCenterPoint and BrokenLineTypeNormal

BrokenLineTypeNormalIs an ordinary broken line chart BrokenLineTypeCenterPointmade the selected point always centered

Besides BrokenLineType ,There are two more parameters when creating an object,one is frame, the other is object ECBrokenLineConfig ,parameters below:

You can use ECBrokenLineConfig to configure the attributes of the brokenLine charts,Each attribute is set to default values.Of course you can use 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 is called when the point on the line is clicked.

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

Initialization:

 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];

Data filling: ( If the value is less than the minimum value, the minimum value is displayed。If the value is greater than the maximum value, the maximum value is displayed;point on both sides filled with dashed lines)

[self.brokenLineView reloadLineViewDataWithPointValveList:self.pointValveList
                                                    titleText:self.pointTextList];
    The effect of BrokenLineTypeNormal         The effect of BrokenLineTypeCenterPoint    
EC_lineNormal EC_lineCenterView

ProgressView

Initialization--Just transfer frame.

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

Data filling:

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

The effect of ProgressView:

EC_lineCenterView

BrokenLineChart && ProgressView

Application scene:

EC_lineCenterView

PieChart

Initialization--Just transfer frame.

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

Data filling:Three parameters:percentList、colorList、arcTextList]

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

The effect of PieChart:

EC_lineCenterView

RadarChartView

Initialization--Just transfer frame.

	ECRadarChartView *rView = [ECRadarChartView radarChartViewWithFrame:CGRectMake(60, 350, 270, 270)];
	[self.view addSubview:rView];

Data filling:

	ECRadarChartConfig *config = [[ECRadarChartConfig alloc] init];
	config.backgroupLineNum = 5;
	config.radius = 100;
	config.drawPointArray = @[@[@(0.5),@(0.4),@(0.5),@(0.1),@(0.9)],
	                              @[@(0.4),@(0.5),@(0.2),@(0.8),@(0.1)],
	                              @[@(0.4),@(0.1),@(0.8),@(0.7),@(0.2)]];
	config.drawLineColorArray = @[[UIColor orangeColor],[UIColor greenColor],[UIColor redColor]];
	config.drawLineTitleArray = @[@"Technology",@"Execution",@"Thinking",@"Endurance",@"Speed"];
	 [rView setupRadarChartConfig:config];
	ECRadarChartConfig *config = [[ECRadarChartConfig alloc] init];
	config.backgroupLineNum = 5;
	config.radius = 100;
	config.drawPointArray = @[@[@(0.5),@(0.4),@(0.5),@(0.1),@(0.9),@(0.4)]];
	config.drawLineColorArray = @[[UIColor orangeColor]];
	config.drawLineTitleArray = @[@"Technology",@"Execution",@"Thinking",@"Endurance",@"Speed",@"Power",];
	 [rView setupRadarChartConfig:config];

The effect of PieChart:

EC_lineCenterView

Communication

  • If you found a bug, and can provide steps to reliably reproduce it, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

About

A simple chart lib used for iOS(Objective-c && Swift). :-)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published