You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
letdata=CSPieChartData(key:"test", value:70)
Third Step - Add a delegate CSPieChartDataSource & CSPieChartDelegate to your class & add two delegate methods
publicprotocolCSPieChartDataSource{
/// Component data
func numberOfComponentData()->Intfunc pieChart(_ pieChart:CSPieChart, dataForComponentAt index:Int)->CSPieChartData
/// Component colors
func numberOfComponentColors()->Intfunc pieChart(_ pieChart:CSPieChart, colorForComponentAt index:Int)->UIColor
/// If you are implement this, you can show subView. example) 'UIImageView' or 'UILable'
@objcoptionalfunc numberOfComponentSubViews()->Int@objcoptionalfunc pieChart(_ pieChart:CSPieChart, viewForComponentAt index:Int)->UIView
/// If you are implement this, you apply color to line path
/// Otherwish line color is applied default 'black'
@objcoptionalfunc numberOfLineColors()->Int@objcoptionalfunc pieChart(_ pieChart:CSPieChart, lineColorForComponentAt index:Int)->UIColor}
// Pie chart radius rate that is percentage of frames in the superview. default is 0.7
publicvarpieChartRadiusRate:CGFloat=0.7
// Pie chart line length between component and subview. default is 10
publicvarpieChartLineLength:CGFloat=10
// This is piechart component selecting animation. default is none
publicvarseletingAnimationType:SelectingAnimationType=.none
}