{"id":15037705,"url":"https://github.com/ivnsch/piecharts","last_synced_at":"2026-04-09T05:31:47.712Z","repository":{"id":45216057,"uuid":"77937657","full_name":"ivnsch/PieCharts","owner":"ivnsch","description":"Easy to use and highly customizable pie charts library for iOS","archived":false,"fork":false,"pushed_at":"2023-03-23T21:51:40.000Z","size":335,"stargazers_count":511,"open_issues_count":27,"forks_count":93,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-02T20:43:20.110Z","etag":null,"topics":["chart","graph","ios","pie-chart","swift","swift-3"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivnsch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-01-03T17:18:49.000Z","updated_at":"2025-03-23T13:27:55.000Z","dependencies_parsed_at":"2022-08-29T08:41:34.879Z","dependency_job_id":"72483ddf-e7d1-4ff8-9eb2-63954f20938f","html_url":"https://github.com/ivnsch/PieCharts","commit_stats":null,"previous_names":["i-schuetz/piecharts","owlmafia/piecharts","ivnsch/piecharts","ivanschuetz/piecharts"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivnsch%2FPieCharts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivnsch%2FPieCharts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivnsch%2FPieCharts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivnsch%2FPieCharts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivnsch","download_url":"https://codeload.github.com/ivnsch/PieCharts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249530,"owners_count":20908212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chart","graph","ios","pie-chart","swift","swift-3"],"created_at":"2024-09-24T20:35:23.031Z","updated_at":"2025-10-12T09:02:25.597Z","avatar_url":"https://github.com/ivnsch.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PieCharts\n\n[![Version](https://img.shields.io/cocoapods/v/PieCharts.svg?style=flat)](http://cocoadocs.org/docsets/PieCharts)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![License](https://img.shields.io/cocoapods/l/PieCharts.svg?style=flat)](http://cocoadocs.org/docsets/PieCharts)\n\nEasy to use and highly customizable pie charts library for iOS\n\nSwift 4.2, iOS 8+\n\n[Video](https://youtu.be/LPFTPMDKDAE)\n\n![ScreenShot](Screenshots/IMG_1279.PNG)![ScreenShot](Screenshots/IMG_1278.PNG)\n\n## Features:\n- Customizable slices\n- Add overlays using simple UIViews\n- Interactive\n- Animated\n- Dynamic slice insertion\n- Reusable components via extensible layer system\n- Configurable in interface builder\n- [Legends](https://github.com/i-schuetz/ChartLegends). This is in a separate project to keep things focused and reusable.\n\n## Installation\n\n### CocoaPods\n\nAdd to your Podfile:\n\n```ruby\nuse_frameworks!\npod 'PieCharts'\n```\n\n### Carthage\n\nAdd to your Cartfile:\n\n```\ngithub \"i-schuetz/PieCharts\"\n```\n\n## Usage\n\n### Basic chart:\n\n```swift\n@IBOutlet weak var chartView: PieChart!\n\nchartView.models = [\n    PieSliceModel(value: 2.1, color: UIColor.yellow),\n    PieSliceModel(value: 3, color: UIColor.blue),\n    PieSliceModel(value: 1, color: UIColor.green)\n]\n```\n\nConfigurable in interface builder, with live update of the view:\n\n![ScreenShot](Screenshots/IB.PNG)\n\n### Overlays:\n\nOverlays are implemented using layers. There are several built in layers and you also can implement your own ones. \n\nTo add text e.g. text labels inside the slices + text with lines outside, simply:\n```swift\nchartView.layers = [PiePlainTextLayer(), PieLineTextLayer()]\n\n```\n\nEach layer has its own customization options. For example, here we customize the plain labels layer:\n\n```swift\nlet textLayerSettings = PiePlainTextLayerSettings()\ntextLayerSettings.viewRadius = 55\ntextLayerSettings.hideOnOverflow = true\ntextLayerSettings.label.font = UIFont.systemFont(ofSize: 8)\n\nlet formatter = NumberFormatter()\nformatter.maximumFractionDigits = 1\ntextLayerSettings.label.textGenerator = {slice in\n    return formatter.string(from: slice.data.percentage * 100 as NSNumber).map{\"\\($0)%\"} ?? \"\"\n}\n\nlet textLayer = PiePlainTextLayer()\ntextLayer.animator = AlphaPieViewLayerAnimator()\ntextLayer.settings = textLayerSettings\n\n```\n\nThis is the custom views layer, which makes possible to create custom views:\n```swift\nlet viewLayer = PieCustomViewsLayer()\n\nlet settings = PieCustomViewsLayerSettings()\nsettings.viewRadius = 135\nsettings.hideOnOverflow = false\nviewLayer.settings = settings\n\nviewLayer.viewGenerator = {slice, center in\n    let myView = UIView()\n    // add images, animations, etc.\n    return myView\n}\n\n```\n\n### Interactivity, events:\n\nConform to `PieChartDelegate` to react to interaction and other events:\n\n```swift\nfunc onGenerateSlice(slice: PieSlice)\nfunc onStartAnimation(slice: PieSlice)\nfunc onEndAnimation(slice: PieSlice)\nfunc onSelected(slice: PieSlice, selected: Bool)\n```\n\n### Dynamic slice insertion:\n\n```swift\nchartView.insertSlice(index: 1, model: PieSliceModel(value: 5, color: UIColor.blue))\n```\n\n## Contributing\n\n1. Fork\n2. Commit changes to a branch in your fork\n3. Push your code and make a pull request\n\n## Outlook\n\nThe layer system can be abstracted a step further in order to make the slices themselves be in a layer. This way we can combine multiple slice-layers to create more complex types of pie charts.\n\n## Credits\n\nThe food images used in the demo are from freepik.com, and flaticon.com/authors/madebyoliver\n\n## Created By:\n\nIvan Schütz\n\n## License\n\nSwiftCharts is Copyright (c) 2017 Ivan Schütz and released as open source under the attached [Apache 2.0 license](LICENSE).\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,  \nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  \nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  \nIN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR  \nOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,  \nARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR  \nOTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivnsch%2Fpiecharts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivnsch%2Fpiecharts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivnsch%2Fpiecharts/lists"}