Swift package for displaying charts effortlessly.
It supports currently:
- barcharts
- piecharts
It requires iOS 13 and xCode 11!
In xCode got to File -> Swift Packages -> Add Package Dependency and paste inthe repo's url: https://github.com/AppPear/ChartView
import the package in the file you would like to use it: import SwiftUICharts
You can display a Chart by adding a chart view to your parent view:
Barchart:
ChartView(data: [8,23,54,32,12,37,7,23,43], title: "Barchart")Piechart:
PieChartView(data:[43,56,78,34], title: "Piechart")You can optionally configure:
- legend
- background color
- accent color
- size format
Can be
- small
- medium
- large
ChartView(data: [12,17,24,33,23,56], title: "Chart two", form: Form.small)I added color constants, so you can predefine your color palette. To do so, you can find Colors struct in the ChartColors swift file.
ChartView(data: [12,17,24,33,23,56], title: "Chart two", backgroundColor:Colors.color3 , accentColor:Colors.color3Accent)
