This is pie chart that is very easy to use and customizable design.
Swift Ruby
Latest commit 391b62b Jan 24, 2017 @youkchansim pod spec up
Permalink
Failed to load latest commit information.
CSPieChart Crash bug fix Jan 24, 2017
Example update readme resource Jan 23, 2017
.gitignore Initial commit Jan 4, 2017
.swift-version update swift version Jan 9, 2017
CSPieChart.podspec pod spec up Jan 24, 2017
LICENSE Create pod project Jan 4, 2017
README.md Update README.md Jan 24, 2017
_Pods.xcodeproj Create pod project Jan 4, 2017

README.md

CSPieChart

Version License iOS 8.3+ Swift 3.0+

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

CSPieChart is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "CSPieChart"

Useage

First Step - import CSPieChart to your project

Second Step - You should CSPieChartData. This is model for piechart.

  let data = CSPieChartData(key: "test", value: 70)

Third Step - Add a delegate CSPieChartDataSource & CSPieChartDelegate to your class & add two delegate methods

public protocol CSPieChartDataSource {
    //  This is data for component
    func numberOfComponentData() -> Int
    func pieChartComponentData(at index: Int) -> CSPieChartData

    //  This is colors that is component
    func numberOfComponentColors() -> Int
    func pieChartComponentColor(at index: Int) -> UIColor

    //  If you implement this, you can show subView. example) 'UIImageView' or 'UILable'
    //  Caution!! You must designate view frame.
    optional func numberOfComponentSubViews() -> Int
    optional func pieChartComponentSubView(at index: Int) -> UIView

    //  If you are implement this, you apply color to line path
    //  Otherwish line color is applied default 'black'
    optional func numberOfLineColors() -> Int
    optional func pieChartLineColor(at index: Int) -> UIColor
}
public protocol CSPieChartDelegate {
    optional func didSelectedPieChartComponent(at index: Int)
}

You can set some options

    //  Pie chart radius rate that is percentage of frames in the superview. default is 0.7
    public var pieChartRadiusRate: CGFloat = 0.7

    // Pie chart line length between component and subview. default is 10
    public var pieChartLineLength: CGFloat = 10

    //  This is piechart component selecting animation. default is none
    public var seletingAnimationType: SelectingAnimationType = .none
}

If you need more information, check example

Author

chansim.youk, dbrckstla@naver.com

License

CSPieChart is available under the MIT license. See the LICENSE file for more info.