Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spacenation/swiftui-charts
:rocket: SwiftUI Charts with custom styles
https://github.com/spacenation/swiftui-charts
apple charts ios macos swift swift-library swift-package swiftui swiftui-example tvos watchos xcode
Last synced: 25 days ago
JSON representation
:rocket: SwiftUI Charts with custom styles
- Host: GitHub
- URL: https://github.com/spacenation/swiftui-charts
- Owner: spacenation
- License: mit
- Created: 2020-01-26T01:22:48.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-27T04:37:47.000Z (about 3 years ago)
- Last Synced: 2024-08-03T18:11:48.913Z (4 months ago)
- Topics: apple, charts, ios, macos, swift, swift-library, swift-package, swiftui, swiftui-example, tvos, watchos, xcode
- Language: Swift
- Homepage:
- Size: 881 KB
- Stars: 678
- Watchers: 20
- Forks: 63
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-swiftui-libraries - swiftui-charts - SwiftUI Charts with custom styles (Chart / Content)
- stars - swiftui-charts
- stars - swiftui-charts
README
## SwiftUI Charts
Build custom charts with SwiftUI## Styles
### Line
```swift
Chart(data: [0.1, 0.3, 0.2, 0.5, 0.4, 0.9, 0.1])
.chartStyle(
LineChartStyle(.quadCurve, lineColor: .blue, lineWidth: 5)
)
```### Area
```swift
Chart(data: [0.1, 0.3, 0.2, 0.5, 0.4, 0.9, 0.1])
.chartStyle(
AreaChartStyle(.quadCurve, fill:
LinearGradient(gradient: .init(colors: [Color.blue.opacity(0.2), Color.blue.opacity(0.05)]), startPoint: .top, endPoint: .bottom)
)
)
```### Stacked Area
```swift
Chart(data: matrix)
.chartStyle(
StackedAreaChartStyle(.quadCurve, colors: [.yellow, .orange, .red])
)
```### Column
```swift
Chart(data: [0.1, 0.3, 0.2, 0.5, 0.4, 0.9, 0.1])
.chartStyle(
ColumnChartStyle(column: Capsule().foregroundColor(.green), spacing: 2)
)
```### Stacked Column
```swift
Chart(data: matrix)
.chartStyle(
StackedColumnChartStyle(spacing: 2, cornerRadius: 3, colors: [.yellow, .orange, .red])
)
```## Install
Add `Charts` to your project with Swift Package Manager```swift
// swift-tools-version:5.1
import PackageDescriptionlet package = Package(
name: "YOUR_PROJECT",
dependencies: [
.package(url: "https://github.com/spacenation/swiftui-charts.git", from: "1.0.0"),
]
)
```## Roadmap
- Bar chart style## Code Contributions
Feel free to contribute via fork/pull request to master branch. If you want to request a feature or report a bug please start a new issue.