Development platform: iOS Language: Swift UI framework: UIKit Compatibility: iOS 11 or greater
Description
TomatoAnimatedPieChart Framework lets you create a simple 2D pie chart. Each pie in the chart will increase its size in animation. The following is a list of features.
Create a pie chart with colors of your selection.
Adjust the animation speed.
Show the name of each pie at the bottom.
Installation
In order to use this framework, download the sample project. You will find the folder titled TomatoAnimatedPieChart in it. Locate the Xcode file inside. And put this Xcode file in your Xcode project. Select your target and make sure you have TomatoPieChartFramework.framework under General > Framworks, Libraries, and Embeded Content as shown below.
In the view controller where to show a pie chart, create an array of chart models with TomatoChartModel. This struct takes four properties: name (String), percentage (CGFloat), color (UIColor) and end (CGFloat). The name property is the name of a pie. The percentage property refers to the share of the pie. The color property, of course, refers to the color of the pie. The last one (end) is used by the framework. So set it to 0.0 or any number.
Variables
starter: It's the very degree where the first pie starts. If you want the first pie to start at 0 o'clock, set it to 0.
topSpace: It is the space between the top edge of the view with or without the navigation controller and the chart.
radius: It's the radius of the pie chart.
pieThickness: It's the thickness (stroke length) of the pie.
innerBorder: It's the thickness of the translucent ring around the hole
outerBorder: It's the thickness of the outer border of the pie chart.
innerAlpha: It's the opacity level of the translucent ring around the hole. If you set it 1, this ring will become completely white.
outerBorderColor: It's the color of the outer border.
rectWidth: It's the width of the color rectangle in the title container.
labelHeight: It's the height of the label of the pie name.
labelFontSize: It's the font size of the pie name label.
labelTextColor: It's the text color of the pie name label.
labelSpace: It's the vertical space between two pie name labels.
decimalNum: This number (0, 1, 2 or 3) determines how many decimal points you want to have in indicating the share of each pie.
titleContainerWidth: It's the width of the title container.
titleContainerBackColor: It's the background color of the title container.
titleContainerLayerCornerRadius: It's the corner radius of the title container.
titleContainerBottomSpace: It's the space between the title container and the bottom edge of the view.
animationDuration: It's the duration of the animation.
🎈 Curated collection of advanced animations that I have developed using (Swift UI for iOS) and (React Native for iOS/Android). Source code is intended to be reused by myself for future projects.