Skip to content
Open

1 #1

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
7a9f013
Hi, I find that the LineChartView has a value is static (#15)
sy1995 Nov 11, 2019
3f542f9
Added LineView
AppPear Nov 11, 2019
e5c309e
set to public
AppPear Nov 11, 2019
e081d3a
fixed loupe
AppPear Nov 11, 2019
6cc43d9
fixed legend in dark mode
AppPear Nov 11, 2019
d3d0b08
updated readme
AppPear Nov 11, 2019
1b45a6a
Update README.md
AppPear Nov 11, 2019
b5e3aa8
added self
AppPear Nov 13, 2019
9fa7e20
Merge remote-tracking branch 'refs/remotes/origin/master'
AppPear Nov 13, 2019
20fb782
quick fix for 0 elements in line view
AppPear Nov 13, 2019
fd14ca2
Allow graphs to accept Double (#19)
szweier Nov 24, 2019
0d95dbd
Fixed: Form redeclaration as ChartForm issue #23
AppPear Dec 12, 2019
03f9072
solved line view negative numbers, also when it crashed 0 or 1 elemen…
AppPear Dec 27, 2019
524aec2
Fixed Issue 28 (#29)
iRick92 Dec 28, 2019
9f2e3d3
Fixed Xcode typo in README (#32)
weitieda Jan 5, 2020
04b6e38
Fixed chart clipping, and value animation issue
AppPear Jan 7, 2020
f7d9895
Merge remote-tracking branch 'refs/remotes/origin/master'
AppPear Jan 7, 2020
1e362b9
Added Label,Value pairs so you can display a label for each point in …
AppPear Jan 11, 2020
6b5affa
Update README.md (#33)
mcgloch Jan 16, 2020
75df39f
Fix animation undoing itself by multiple calls of toggle() (#35)
barclayd Jan 17, 2020
37c51d9
Fix llvm segfault when archiving SwiftUICharts (#36)
kfowler Jan 17, 2020
88db9ae
Fix line chart view indicator point (#40)
xspyhack Jan 22, 2020
80d546d
fixed lineview for small negative numbers
AppPear Feb 13, 2020
ba5bc4f
Fixed barchart crashing for empty array
AppPear Feb 13, 2020
37779e1
added a darkmodestyle so you can customize darkmode appearance for li…
AppPear Feb 13, 2020
841bde1
Fixed infinite size compile error
AppPear Feb 13, 2020
47731bf
Added cutom darkmode style description
AppPear Feb 13, 2020
2a1b55f
Adding multiline chartview and straight linechart
AppPear Mar 3, 2020
a8b4101
Merge remote-tracking branch 'refs/remotes/origin/master'
AppPear Mar 3, 2020
b230ed0
Fix to use dark mode settings for barchatview label text. (#47)
andrw Mar 3, 2020
6a9546b
added id: self in ForEach for dynamic content in BarChartRow (#49)
ftlno Mar 3, 2020
257e5fc
Fixed global max and min for multiline chartview
AppPear Mar 3, 2020
7365bc9
Added MultiLineChartView, fixed LineView legend disappearing on navig…
AppPear Mar 4, 2020
04989ad
Updated ReadMe with multilinechartview
AppPear Mar 4, 2020
75804f4
Customisable drop shadow color (#53)
AppPear Mar 5, 2020
c12c773
fixed unwrap error
AppPear Mar 17, 2020
a242bd3
Making GradientColor's init method as public (#63)
dellacqp Apr 26, 2020
fada162
change rateValue to optional to fix crash from force unwraps and set …
May 7, 2020
dd7a1fc
Line view custom gradient (#67)
platadani May 18, 2020
fa8e015
adds issue templates (#88)
LucasCarioca May 22, 2020
068ea84
adds pr template (#90)
LucasCarioca May 22, 2020
0303c3c
Update README.md
AppPear May 24, 2020
ebd09f4
Fix issue templates (#92)
LucasCarioca May 24, 2020
640ddeb
Create v2Ticket
AppPear May 24, 2020
3447d5c
Rename v2Ticket to v2Ticket.md
AppPear May 24, 2020
b5b7c62
Update v2Ticket.md
AppPear May 24, 2020
22a38a1
Update README.md
AppPear May 24, 2020
82e8f24
Create swift.yml
AppPear May 28, 2020
c89b1e1
Update Package.swift
AppPear May 28, 2020
24cf9ea
Update README.md (#106)
satan87 May 28, 2020
7568c5d
Bug Fix - only 0 data (#109)
satan87 May 30, 2020
74140af
Add extra large size (#108)
satan87 May 31, 2020
27e7e0d
Bigger scale (#113)
satan87 Jun 16, 2020
ca19dd5
Cleanup the explicitly unwrapped parameters which had a default value…
rodericj Jun 27, 2020
a36c1db
Update README.md
AppPear Jun 27, 2020
4705267
Builded with xcode 12
AppPear Jun 28, 2020
c6610f5
Fixed control flow error
AppPear Jul 5, 2020
812e028
Update README.md
AppPear Jul 25, 2020
6c612fa
Fix typo (#144)
cs4alhaider Jul 26, 2020
6c768ad
created interaction for PieChart (#147)
Lebron1992 Aug 1, 2020
4699847
Fixed missing self in piechartrow
AppPear Aug 1, 2020
08f0053
update slack link
AppPear Sep 23, 2020
5aa8cdf
macOS support: v11 only. Swift tools bumped to 5.3 (#183)
willtemperley Mar 24, 2021
29700ff
made cornerImage optional (#76)
Mar 26, 2021
5c49a55
fix(LineChartView): fixed linechart shifting down
AppPear Mar 26, 2021
9249098
[WIP]Add an option to animate to back position (BarChart). (#171)
fummicc1 Mar 26, 2021
1f4949a
Bugfix: Draw Lines (#173)
magicmikek Mar 26, 2021
eca6eda
Bugfix: Line height in LineView (#175)
willdale Mar 26, 2021
9115a99
Add legend format specifier option in LineView (#186)
Cljak10 Mar 26, 2021
aecfdc5
Add id in ForEach in MultiLineChartView for dynamic content (#203)
kugo12 Aug 11, 2021
a4381e0
modify LineChartView rateValue set code (#200)
auburn0820 Aug 11, 2021
6acb264
Update README.md
AppPear Aug 25, 2021
c360f8a
Update README.md
AppPear Aug 25, 2021
13ab3af
feat: move images from resource folder to cloud (#208)
AppPear Aug 28, 2021
102b51b
feat: added wiki article links to readme
AppPear Aug 28, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---
<!--- Provide a general summary of the issue in the Title above -->



## Description
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->

## Expected Behavior
<!--- Tell us what should happen -->

## Actual Behavior
<!--- Tell us what happens instead -->

## Possible Fix
<!--- Not obligatory, but suggest a fix or reason for the bug -->

## Steps to Reproduce
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->

## Your Environment
<!--- Include as many relevant details about the environment -->
* Version of this package used:
* Device/Simulator:
* Operating System and version:
* Link to your project:
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Ask for a new feature
title: ''
labels: ''
assignees: ''

---

<!--- Provide a general summary of the issue in the Title above -->

## Detailed Description
<!--- Provide a detailed description of the change or addition you are proposing -->

## Context
<!--- Why is this change important to you? How would you use it? -->
<!--- How can it benefit other users? -->

## Possible Implementation
<!--- Not obligatory, but suggest an idea for implementing addition or change -->
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/v2Ticket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: v2 ticket
about: Create tasks for the upcoming new version
title: ''
labels: v2
assignees: ''

---
# v2 ticket

## Ticket description:
29 changes: 29 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--- Provide a general summary of your changes in the Title above -->

## Description
<!--- Describe your changes in detail -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran to -->
<!--- see how your change affects other areas of the code, etc. -->

## Screenshots (if appropriate):

## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Non-functional change (Updating Documentation, CI automation, etc..)

## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
22 changes: 22 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Swift

on:
push:
branches:
- master
- new-version
pull_request:
branches:
- master
- new-version
jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/.build
/Packages
/*.xcodeproj
.swiftpm
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>SwiftUICharts.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>3</integer>
</dict>
</dict>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// swift-tools-version:5.1
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftUICharts",
platforms: [
.iOS(.v13),.watchOS(.v6)
.iOS(.v13), .watchOS(.v6), .macOS(.v11)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
Expand Down
152 changes: 128 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,43 @@

Swift package for displaying charts effortlessly.

![SwiftUI Charts](./showcase1.gif "SwiftUI Charts")
## V2 Beta is here 🎉🎉🎉

V2 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.
So you decide, whether you build a fully fledged interactive view, or just display a bare bone chart

* [How to install SwiftUI ChartView](https://github.com/AppPear/ChartView/wiki/How-to-install-SwiftUI-ChartView)

* [How to create your first chart](https://github.com/AppPear/ChartView/wiki/How-to-create-your-first-chart)

### It supports interactions and animations
<img src="https://user-images.githubusercontent.com/2826764/130787802-9aa619ee-05de-4343-ba3c-1796e4d05e08.gif" width="26%"></img> <img src="https://user-images.githubusercontent.com/2826764/130787814-283f3d26-6c9d-448b-b2c7-879e60a3b05d.gif" width="26%"></img>

### It is fully customizable, and works together with native SwiftUI elements well
<img src="https://user-images.githubusercontent.com/2826764/130785262-010d6791-16cf-485d-b920-29e4086477e2.png" width="45%"></img> <img src="https://user-images.githubusercontent.com/2826764/130785266-94a08622-2963-4177-8777-8bd3ad463809.png" width="45%"></img> <img src="https://user-images.githubusercontent.com/2826764/130785268-284314de-ba96-4fb7-a1e5-8a46578e1f0e.png" width="45%"></img>


## Original (stable) version:

<img src="https://user-images.githubusercontent.com/2826764/131211993-5d33312b-09af-44b4-a32e-ffaad739adfe.gif" width="45%"></img> <img src="https://user-images.githubusercontent.com/2826764/131211994-48c9ce4e-2e67-40a0-b727-c88bdbd22cd0.gif" width="45%">

### Usage

It supports:
* Line charts
* Bar charts
* Pie charts

### Slack
Join our Slack channel for day to day conversation and more insights:

[Slack invite link](https://join.slack.com/t/swiftuichartview/shared_invite/zt-g6mxioq8-j3iUTF1YKX7D23ML3qcc4g)

### Installation:

It requires iOS 13 and xCode 11!
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`
In Xcode go to `File -> Swift Packages -> Add Package Dependency` and paste in the repo's url: `https://github.com/AppPear/ChartView`

### Usage:

Expand All @@ -26,7 +51,47 @@ You can display a Chart by adding a chart view to your parent view:
Added an example project, with **iOS, watchOS** target: https://github.com/AppPear/ChartViewDemo

## Line charts
![Line Charts](./showcase3.gif "Line Charts")

**LineChartView with multiple lines!**
First 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.

<img src="https://user-images.githubusercontent.com/2826764/131211991-eca64276-cf05-423f-a78a-697c55e44bbc.gif" width="50%"></img>

Usage:
```swift
MultiLineChartView(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")
```
Gradient colors are now under the `GradientColor` struct you can create your own gradient by `GradientColor(start: Color, end: Color)`

Available preset gradients:
* orange
* blue
* green
* blu
* bluPurpl
* purple
* prplPink
* prplNeon
* orngPink

**Full screen view called LineView!!!**


```swift
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen") // legend is optional, use optional .padding()
```

Adopts to dark mode automatically

<img src="https://user-images.githubusercontent.com/2826764/131211977-27439357-491d-4872-a6bd-f696edac4c7f.gif" width="45%"></img> <img src="https://user-images.githubusercontent.com/2826764/131211985-f77464d6-7fd8-429d-9e77-9f9bc7424d32.gif" width="45%">

You can add your custom darkmode style by specifying:

```swift
let myCustomStyle = ChartStyle(...)
let myCutsomDarkModeStyle = ChartStyle(...)
myCustomStyle.darkModeStyle = myCutsomDarkModeStyle
```

**Line chart is interactive, so you can drag across to reveal the data points**

Expand All @@ -36,27 +101,61 @@ You can add a line chart with the following code:
LineChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", legend: "Legendary") // legend is optional
```

**Turn drop shadow off by adding to the Initialiser: `dropShadow: false`**


## Bar charts
![Bar Charts](./showcase2.gif "Bar Charts")
<img src="https://user-images.githubusercontent.com/2826764/131211994-48c9ce4e-2e67-40a0-b727-c88bdbd22cd0.gif" width="45%">

**[New feature] you can display labels also along values and points for each bar to descirbe your data better!**
**Bar chart is interactive, so you can drag across to reveal the data points**

You can add a bar chart with the following code:

Labels and points:

```swift
BarChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", legend: "Legendary") // legend is optional
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
```
Only points:

```swift
BarChartView(data: ChartData(points: [8,23,54,32,12,37,7,23,43]), title: "Title", legend: "Legendary") // legend is optional
```

**ChartData** structure
Stores values in data pairs (actually tuple): `(String,Double)`
* you can have duplicate values
* keeps the data order

You can initialise ChartData multiple ways:
* For integer values: `ChartData(points: [8,23,54,32,12,37,7,23,43])`
* For floating point values: `ChartData(points: [2.34,3.14,4.56])`
* For label,value pairs: `ChartData(values: [("2018 Q4",63150), ("2019 Q1",50900)])`


You can add different formats:
* Small `Form.small`
* Medium `Form.medium`
* Large `Form.large`

```swift
BarChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", form: Form.small)
```

* Small `ChartForm.small`
* Medium `ChartForm.medium`
* Large `ChartForm.large`

```swift
BarChartView(data: ChartData(points: [8,23,54,32,12,37,7,23,43]), title: "Title", form: ChartForm.small)
```

For floating point numbers, you can set a custom specifier:

```swift
BarChartView(data: ChartData(points:[1.23,2.43,3.37]) ,title: "A", valueSpecifier: "%.2f")
```
For integers you can disable by passing: `valueSpecifier: "%.0f"`


You can set your custom image in the upper right corner by passing in the initialiser: `cornerImage:Image(systemName: "waveform.path.ecg")`


**Turn drop shadow off by adding to the Initialiser: `dropShadow: false`**

### You can customize styling of the chart with a ChartStyle object:

Customizable:
Expand All @@ -67,7 +166,7 @@ Customizable:
* legend text color

```swift
let chartStyle = ChartStyle(backgroundColor: Color.black, accentColor: Colors.OrangeStart, secondGradientColor: Colors.OrangeEnd, chartFormSize: Form.medium, textColor: Color.white, legendTextColor: Color.white )
let chartStyle = ChartStyle(backgroundColor: Color.black, accentColor: Colors.OrangeStart, secondGradientColor: Colors.OrangeEnd, chartFormSize: ChartForm.medium, textColor: Color.white, legendTextColor: Color.white )
...
BarChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", style: chartStyle)
```
Expand All @@ -84,33 +183,38 @@ You can access built-in styles:
* barChartMidnightGreenLight
* barChartMidnightGreenDark

![Midnightgreen](./midnightgreen.gif "Midnightgreen")

![Custom Charts](./showcase5.png "Custom Charts")
<img src="https://user-images.githubusercontent.com/2826764/131211990-e41cec90-38f4-4965-8bdc-41c30b79acea.gif" width="45%">

<img src="https://user-images.githubusercontent.com/2826764/131211999-6ec4f13b-0465-4135-b576-76e31b11a2c6.png" width="45%">

### You can customize the size of the chart with a Form object:
### You can customize the size of the chart with a ChartForm object:

**Form**
**ChartForm**
* `.small`
* `.medium`
* `.large`
* `.detail`

```swift
BarChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", form: Form.small)
BarChartView(data: [8,23,54,32,12,37,7,23,43], title: "Title", form: ChartForm.small)
```

### You can choose whether bar is animated or not after completing your gesture.

If you want to animate back movement after completing your gesture, you set `animatedToBack` as `true`.

### WatchOS support for Bar charts:

![Pie Charts](./watchos1.png "Pie Charts")
<img src="https://user-images.githubusercontent.com/2826764/131212000-a058fdd9-af40-4e64-adc3-82201ea2484d.png" width="45%">

## Pie charts
![Pie Charts](./showcase4.png "Pie Charts")
<img src="https://user-images.githubusercontent.com/2826764/131211998-e142657d-0ebc-43b7-aeda-07cae4d9e34b.png" width="45%">

You can add a line chart with the following code:
You can add a pie chart with the following code:

```swift
PieChartView(data: [8,23,54,32], title: "Title", legend: "Legendary") // legend is optional
```

**Turn drop shadow off by adding to the Initialiser: `dropShadow: false`**

Loading