{"id":13461798,"url":"https://github.com/AppPear/ChartView","last_synced_at":"2025-03-24T22:35:05.055Z","repository":{"id":37734126,"uuid":"191625817","full_name":"AppPear/ChartView","owner":"AppPear","description":"ChartView made in SwiftUI","archived":false,"fork":false,"pushed_at":"2023-11-30T00:38:51.000Z","size":4822,"stargazers_count":5462,"open_issues_count":99,"forks_count":655,"subscribers_count":100,"default_branch":"master","last_synced_at":"2025-03-20T17:08:46.789Z","etag":null,"topics":["chart","charts","ios","swift","swiftui"],"latest_commit_sha":null,"homepage":"","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/AppPear.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-06-12T18:38:58.000Z","updated_at":"2025-03-20T03:38:33.000Z","dependencies_parsed_at":"2024-01-29T16:57:56.580Z","dependency_job_id":"94a7d125-78e8-4d12-a0cf-b1e185675f73","html_url":"https://github.com/AppPear/ChartView","commit_stats":{"total_commits":96,"total_committers":29,"mean_commits":3.310344827586207,"dds":0.34375,"last_synced_commit":"102b51bff6d2edcb4d0962d05795938199fe3eba"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AppPear%2FChartView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AppPear","download_url":"https://codeload.github.com/AppPear/ChartView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245366204,"owners_count":20603438,"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","charts","ios","swift","swiftui"],"created_at":"2024-07-31T11:00:57.935Z","updated_at":"2025-03-24T22:35:00.042Z","avatar_url":"https://github.com/AppPear.png","language":"Swift","readme":"# SwiftUICharts\n\nSwift package for displaying charts effortlessly.\n\n## V2 Beta is here 🎉🎉🎉\n\nV2 focuses on providing a strong and easy to use base, on which you can build your beautiful custom charts. It provides basic building blocks, like a chart view (bar, pie, line and ring chart), grid view, card view, interactive label for displaying the curent chart value. \nSo you decide, whether you build a fully fledged interactive view, or just display a bare bone chart\n\n* [How to install SwiftUI ChartView](https://github.com/AppPear/ChartView/wiki/How-to-install-SwiftUI-ChartView)\n\n* [How to create your first chart](https://github.com/AppPear/ChartView/wiki/How-to-create-your-first-chart)\n\n### It supports interactions and animations\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/130787802-9aa619ee-05de-4343-ba3c-1796e4d05e08.gif\" width=\"26%\"\u003e\u003c/img\u003e \u003cimg src=\"https://user-images.githubusercontent.com/2826764/130787814-283f3d26-6c9d-448b-b2c7-879e60a3b05d.gif\" width=\"26%\"\u003e\u003c/img\u003e \n\n### It is fully customizable, and works together with native SwiftUI elements well\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/130785262-010d6791-16cf-485d-b920-29e4086477e2.png\" width=\"45%\"\u003e\u003c/img\u003e \u003cimg src=\"https://user-images.githubusercontent.com/2826764/130785266-94a08622-2963-4177-8777-8bd3ad463809.png\" width=\"45%\"\u003e\u003c/img\u003e \u003cimg src=\"https://user-images.githubusercontent.com/2826764/130785268-284314de-ba96-4fb7-a1e5-8a46578e1f0e.png\" width=\"45%\"\u003e\u003c/img\u003e \n\n\n## Original (stable) version: \n\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211993-5d33312b-09af-44b4-a32e-ffaad739adfe.gif\" width=\"45%\"\u003e\u003c/img\u003e \u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211994-48c9ce4e-2e67-40a0-b727-c88bdbd22cd0.gif\" width=\"45%\"\u003e\n\n### Usage\n\nIt supports:\n* Line charts\n* Bar charts\n* Pie charts\n\n### Slack\nJoin our Slack channel for day to day conversation and more insights:\n\n[Slack invite link](https://join.slack.com/t/swiftuichartview/shared_invite/zt-g6mxioq8-j3iUTF1YKX7D23ML3qcc4g)\n\n### Installation:\n\nIt requires iOS 13 and Xcode 11!\n\nIn Xcode go to `File -\u003e Swift Packages -\u003e Add Package Dependency` and paste in the repo's url: `https://github.com/AppPear/ChartView`\n\n### Usage:\n\nimport the package in the file you would like to use it: `import SwiftUICharts`\n\nYou can display a Chart by adding a chart view to your parent view: \n\n### Demo\n\nAdded an example project, with **iOS, watchOS** target: https://github.com/AppPear/ChartViewDemo\n\n## Line charts\n\n**LineChartView with multiple lines!**\nFirst release of this feature, interaction is disabled for now, I'll figure it out how could be the best to interact with multiple lines with a single touch.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211991-eca64276-cf05-423f-a78a-697c55e44bbc.gif\" width=\"50%\"\u003e\u003c/img\u003e\n\nUsage:\n```swift\nMultiLineChartView(data: [([8,32,11,23,40,28], GradientColors.green), ([90,99,78,111,70,60,77], GradientColors.purple), ([34,56,72,38,43,100,50], GradientColors.orngPink)], title: \"Title\")\n```\nGradient colors are now under the `GradientColor` struct you can create your own gradient by `GradientColor(start: Color, end: Color)`\n\nAvailable preset gradients: \n* orange \n* blue\n* green\n* blu \n* bluPurpl\n* purple\n* prplPink \n* prplNeon\n* orngPink\n\n**Full screen view called LineView!!!**\n\n\n```swift\n LineView(data: [8,23,54,32,12,37,7,23,43], title: \"Line chart\", legend: \"Full screen\") // legend is optional, use optional .padding()\n```\n\nAdopts to dark mode automatically \n\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211977-27439357-491d-4872-a6bd-f696edac4c7f.gif\" width=\"45%\"\u003e\u003c/img\u003e \u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211985-f77464d6-7fd8-429d-9e77-9f9bc7424d32.gif\" width=\"45%\"\u003e\n\nYou can add your custom darkmode style by specifying:\n\n```swift\nlet myCustomStyle = ChartStyle(...)\nlet myCutsomDarkModeStyle = ChartStyle(...)\nmyCustomStyle.darkModeStyle = myCutsomDarkModeStyle\n```\n\n**Line chart is interactive, so you can drag across to reveal the data points**\n\nYou can add a line chart with the following code: \n\n```swift\n LineChartView(data: [8,23,54,32,12,37,7,23,43], title: \"Title\", legend: \"Legendary\") // legend is optional\n```\n\n**Turn drop shadow off by adding to the Initialiser: `dropShadow: false`**\n\n\n## Bar charts\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211994-48c9ce4e-2e67-40a0-b727-c88bdbd22cd0.gif\" width=\"45%\"\u003e\n\n**[New feature] you can display labels also along values and points for each bar to descirbe your data better!**\n**Bar chart is interactive, so you can drag across to reveal the data points**\n\nYou can add a bar chart with the following code: \n\nLabels and points:\n\n```swift\n BarChartView(data: ChartData(values: [(\"2018 Q4\",63150), (\"2019 Q1\",50900), (\"2019 Q2\",77550), (\"2019 Q3\",79600), (\"2019 Q4\",92550)]), title: \"Sales\", legend: \"Quarterly\") // legend is optional\n```\nOnly points:\n\n```swift\n BarChartView(data: ChartData(points: [8,23,54,32,12,37,7,23,43]), title: \"Title\", legend: \"Legendary\") // legend is optional\n```\n\n**ChartData** structure\nStores values in data pairs (actually tuple): `(String,Double)`\n* you can have duplicate values\n* keeps the data order\n\nYou can initialise ChartData multiple ways:\n* For integer values: `ChartData(points: [8,23,54,32,12,37,7,23,43])`\n* For floating point values: `ChartData(points: [2.34,3.14,4.56])`\n* For label,value pairs: `ChartData(values: [(\"2018 Q4\",63150), (\"2019 Q1\",50900)])`\n\n\nYou can add different formats: \n* Small `ChartForm.small`\n* Medium  `ChartForm.medium`\n* Large `ChartForm.large` \n\n```swift\nBarChartView(data: ChartData(points: [8,23,54,32,12,37,7,23,43]), title: \"Title\", form: ChartForm.small)\n```\n\nFor floating point numbers, you can set a custom specifier: \n\n```swift\nBarChartView(data: ChartData(points:[1.23,2.43,3.37]) ,title: \"A\", valueSpecifier: \"%.2f\")\n```\nFor integers you can disable by passing: `valueSpecifier: \"%.0f\"`\n\n\nYou can set your custom image in the upper right corner by passing in the initialiser: `cornerImage:Image(systemName: \"waveform.path.ecg\")` \n\n\n **Turn drop shadow off by adding to the Initialiser: `dropShadow: false`**\n\n ### You can customize styling of the chart with a ChartStyle object: \n\nCustomizable: \n* background color\n* accent color\n* second gradient color\n* text color\n* legend text color\n\n```swift\n let chartStyle = ChartStyle(backgroundColor: Color.black, accentColor: Colors.OrangeStart, secondGradientColor: Colors.OrangeEnd, chartFormSize: ChartForm.medium, textColor: Color.white, legendTextColor: Color.white )\n ...\n BarChartView(data: [8,23,54,32,12,37,7,23,43], title: \"Title\", style: chartStyle)\n```\n\nYou can access built-in styles: \n```swift\n BarChartView(data: [8,23,54,32,12,37,7,23,43], title: \"Title\", style: Styles.barChartMidnightGreen)\n```\n#### All styles available as a preset: \n* barChartStyleOrangeLight\n* barChartStyleOrangeDark\n* barChartStyleNeonBlueLight\n* barChartStyleNeonBlueDark\n* barChartMidnightGreenLight\n* barChartMidnightGreenDark\n\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211990-e41cec90-38f4-4965-8bdc-41c30b79acea.gif\" width=\"45%\"\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211999-6ec4f13b-0465-4135-b576-76e31b11a2c6.png\" width=\"45%\"\u003e\n\n### You can customize the size of the chart with a ChartForm object: \n\n**ChartForm**\n* `.small`\n* `.medium`\n* `.large`\n* `.detail`\n\n```swift\nBarChartView(data: [8,23,54,32,12,37,7,23,43], title: \"Title\", form: ChartForm.small)\n```\n\n### You can choose whether bar is animated or not after completing your gesture.\n\nIf you want to animate back movement after completing your gesture, you set `animatedToBack` as `true`. \n\n### WatchOS support for Bar charts: \n\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131212000-a058fdd9-af40-4e64-adc3-82201ea2484d.png\" width=\"45%\"\u003e\n\n## Pie charts\n\u003cimg src=\"https://user-images.githubusercontent.com/2826764/131211998-e142657d-0ebc-43b7-aeda-07cae4d9e34b.png\" width=\"45%\"\u003e\n\nYou can add a pie chart with the following code: \n\n```swift\n PieChartView(data: [8,23,54,32], title: \"Title\", legend: \"Legendary\") // legend is optional\n```\n\n**Turn drop shadow off by adding to the Initialiser: `dropShadow: false`**\n\n","funding_links":[],"categories":["Swift","Libs","Chart [🔝](#readme)","Chart","🛠 Examples","开源库精选","🌎 by the community","UI"],"sub_categories":["Chart","Content","Open Source Apps","图表"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppPear%2FChartView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAppPear%2FChartView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAppPear%2FChartView/lists"}