{"id":15055319,"url":"https://github.com/marekpridal/barchart","last_synced_at":"2025-04-07T11:07:48.389Z","repository":{"id":54532285,"uuid":"291308055","full_name":"marekpridal/BarChart","owner":"marekpridal","description":"UIKit / SwiftUI library for creating Bar Chart similar to chart used in iOS Health app.","archived":false,"fork":false,"pushed_at":"2024-11-20T14:53:13.000Z","size":107,"stargazers_count":82,"open_issues_count":1,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-07T11:07:42.791Z","etag":null,"topics":["apple","applewatch","barchart","chart","diagram","graph","healthapp","ios","macos","swift","swift-pm","swiftui","watchos","xcframework"],"latest_commit_sha":null,"homepage":"https://marekpridal.eu","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marekpridal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-29T16:32:27.000Z","updated_at":"2025-01-10T06:44:05.000Z","dependencies_parsed_at":"2023-11-12T10:22:58.834Z","dependency_job_id":"f4a7c5f0-962a-4455-8686-cceda4069da1","html_url":"https://github.com/marekpridal/BarChart","commit_stats":{"total_commits":57,"total_committers":3,"mean_commits":19.0,"dds":0.03508771929824561,"last_synced_commit":"3ce16bd1b063d339d8e13a6014ab1cb907dd7f5a"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marekpridal%2FBarChart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marekpridal%2FBarChart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marekpridal%2FBarChart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marekpridal%2FBarChart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marekpridal","download_url":"https://codeload.github.com/marekpridal/BarChart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247640463,"owners_count":20971557,"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":["apple","applewatch","barchart","chart","diagram","graph","healthapp","ios","macos","swift","swift-pm","swiftui","watchos","xcframework"],"created_at":"2024-09-24T21:40:49.888Z","updated_at":"2025-04-07T11:07:48.368Z","avatar_url":"https://github.com/marekpridal.png","language":"Swift","readme":"# BarChartKit\n\nUIKit / SwiftUI library for creating Bar Chart similar to chart used in iOS Health app.\n\n![Bar Chart screenshot](Resources/Screenshots/BarChart_1.jpg)\n\n## Requirements\n- iOS 13.0+ \n- watchOS 6.0+\n- macOS 10.15+\n\n## Installation\n\n#### BarChartKit supports [XCFramework](https://developer.apple.com/videos/play/wwdc2019/416/) integration into Xcode project. Just go to [Release page](https://github.com/marekpridal/BarChart/releases), download latest version, drag and drop it into existing Xcode project and you are done 🎉\n\nBarChartKit also supports SwiftPM. You can integrate BarChartKit using SwiftPM directly via Xcode or manually using Package.swift.\n\n### [Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)\n\nTo add a package dependency to your Xcode project, select File \u003e Swift Packages \u003e Add Package Dependency and enter its repository URL. You can also navigate to your target’s General pane, and in the “Frameworks, Libraries, and Embedded Content” section, click the + button. In the “Choose frameworks and libraries to add” dialog, select Add Other, and choose Add Package Dependency.\n\nInstead of adding a repository URL, you can search for a package on [GitHub](https://github.com/) or [GitHub Enterprise](https://github.com/enterprise). Add your [GitHub](https://github.com/) or [GitHub Enterprise](https://github.com/enterprise) account in Xcode’s preferences, and a list of package repositories appears as you type. The following screenshot shows the list of repositories for the search term ExamplePackage.\n\n## Usage\n\n### UIKit\n```swift\nimport BarChartKit\n\nlet mockBarChartDataSet: BarChartView.DataSet? = BarChartView.DataSet(elements: [\n    BarChartView.DataSet.DataElement(date: nil, xLabel: \"Jan\", bars: [BarChartView.DataSet.DataElement.Bar(value: 20000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0)),\n                                                              BarChartView.DataSet.DataElement.Bar(value: 15000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0))]),\n    BarChartView.DataSet.DataElement(date: nil, xLabel: \"Feb\", bars: [BarChartView.DataSet.DataElement.Bar(value: 0, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0))]),\n    BarChartView.DataSet.DataElement(date: nil, xLabel: \"Mar\", bars: [BarChartView.DataSet.DataElement.Bar(value: 10000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0)),\n                                                              BarChartView.DataSet.DataElement.Bar(value: 5000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0))]),\n    BarChartView.DataSet.DataElement(date: nil, xLabel: \"Apr\", bars: [BarChartView.DataSet.DataElement.Bar(value: 20000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0)),\n                                                              BarChartView.DataSet.DataElement.Bar(value: 15000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0))]),\n    BarChartView.DataSet.DataElement(date: nil, xLabel: \"May\", bars: [BarChartView.DataSet.DataElement.Bar(value: 32010, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0)),\n                                                              BarChartView.DataSet.DataElement.Bar(value: 15000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0))]),\n    BarChartView.DataSet.DataElement(date: nil, xLabel: \"Jun\", bars: [BarChartView.DataSet.DataElement.Bar(value: 20000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor(red: 214/255, green: 40/255, blue: 57/255, alpha: 1.0))]),\n    BarChartView.DataSet.DataElement(date: nil, xLabel: \"Jul\", bars: [BarChartView.DataSet.DataElement.Bar(value: 20000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor.systemGreen),\n                                                                      BarChartView.DataSet.DataElement.Bar(value: 10000, color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), selectionColor: UIColor.systemBlue)])\n], limit: .init(color: UIColor(red: 208/255, green: 207/255, blue: 209/255, alpha: 1.0), label: \"YOUR LIMIT\", value: 15_010))\n\n\nlet barChart = BarChartView()\nbarChart.dataSet = mockBarChartDataSet\n\nview.addSubview(barChart)\nbarChart.translatesAutoresizingMaskIntoConstraints = false\nNSLayoutConstraint.activate([\n    barChart.leadingAnchor.constraint(equalTo: view.leadingAnchor),\n    barChart.trailingAnchor.constraint(equalTo: view.trailingAnchor),\n    barChart.topAnchor.constraint(equalTo: view.topAnchor),\n    barChart.bottomAnchor.constraint(equalTo: view.bottomAnchor)\n])\n```\n\n### SwiftUI\n```swift\nimport BarChartKit\n\n@State private var selectedElement: BarChart.DataSet.DataElement? = mockBarChartDataSet.elements.first\n\nlet mockBarChartDataSet: BarChart.DataSet = BarChart.DataSet(elements: [\n    BarChart.DataSet.DataElement(date: nil, xLabel: \"Jan\", bars: [BarChart.DataSet.DataElement.Bar(value: 20000, color: Color.green, selectionColor: Color.yellow),\n                                                          BarChart.DataSet.DataElement.Bar(value: 15000, color: Color.blue, selectionColor: Color.yellow)]),\n    BarChart.DataSet.DataElement(date: nil, xLabel: \"Feb\", bars: [BarChart.DataSet.DataElement.Bar(value: 0, color: Color.green)]),\n    BarChart.DataSet.DataElement(date: nil, xLabel: \"Mar\", bars: [BarChart.DataSet.DataElement.Bar(value: 10000, color: Color.green),\n                                                          BarChart.DataSet.DataElement.Bar(value: 5000, color: Color.red)]),\n    BarChart.DataSet.DataElement(date: nil, xLabel: \"Apr\", bars: [BarChart.DataSet.DataElement.Bar(value: 20000, color: Color.green),\n                                                          BarChart.DataSet.DataElement.Bar(value: 15000, color: Color.blue)]),\n    BarChart.DataSet.DataElement(date: nil, xLabel: \"May\", bars: [BarChart.DataSet.DataElement.Bar(value: 42000, color: Color.green, selectionColor: Color.red),\n                                                          BarChart.DataSet.DataElement.Bar(value: 15000, color: Color.blue, selectionColor: Color.yellow)]),\n    BarChart.DataSet.DataElement(date: nil, xLabel: \"Jun\", bars: [BarChart.DataSet.DataElement.Bar(value: 20000, color: Color.green, selectionColor: Color.yellow)]),\n    BarChart.DataSet.DataElement(date: nil, xLabel: \"Jul\", bars: [BarChart.DataSet.DataElement.Bar(value: 20000, color: Color.green, selectionColor: Color.yellow),\n                                                          BarChart.DataSet.DataElement.Bar(value: 0.5555, color: Color.blue, selectionColor: Color.red)])\n    ])\n\n\nBarChart(dataSet: mockBarChartDataSet, selectedElement: $selectedElement)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarekpridal%2Fbarchart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarekpridal%2Fbarchart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarekpridal%2Fbarchart/lists"}