Compare commits

...

5 Commits

Author SHA1 Message Date
Samu Andras 50ab18d047 feat: move images from resource folder to cloud 2021-08-28 11:01:40 +02:00
Andras Samu c360f8a685 Update README.md 2021-08-25 14:37:35 +02:00
Andras Samu 6acb264fb2 Update README.md 2021-08-25 14:35:35 +02:00
Suyeong Pi a4381e037c modify LineChartView rateValue set code (#200) 2021-08-11 22:06:11 +02:00
Szczepan Wiśniowski aecfdc5634 Add id in ForEach in MultiLineChartView for dynamic content (#203) 2021-08-11 22:05:30 +02:00
13 changed files with 31 additions and 20 deletions
+26 -15
View File
@@ -2,15 +2,27 @@
Swift package for displaying charts effortlessly.
**V2 Beta 1 is released, if you would like to try it out you can find a [demo project here](https://github.com/AppPear/ChartViewV2Demo)**
## V2 Beta is here 🎉🎉🎉
**iOS 14 WidgetKit support is coming. In V2 I will update current charts and possibly extend with some new chart types to provide the best support for building informative and beautiful widgets for the new home screen 🥳 Stay tuned!**
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
![SwiftUI Charts](./Resources/showcase1.gif "SwiftUI Charts")
### 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>
### Note:
**A version 2.0 is coming soon!!! 🎉🎉🎉**, so please hold off your PRs for a while. I'm writing a new code base with more sleek code architecture with an option for easier expansion. I'll make beta releases so you can test betas.
**If you'd like to contribute you can find tickets for the new version in the Issues under the `v2` tag, please read more at: [https://github.com/AppPear/ChartView/pull/89](https://github.com/AppPear/ChartView/pull/89)**
### 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>
### Installation
please check out `2.0.0-beta.2` tag
![install](https://user-images.githubusercontent.com/2826764/130789159-02d72b29-41e4-4b5d-8bcb-2229bf984f01.png)
## 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
@@ -42,7 +54,8 @@ Added an example project, with **iOS, watchOS** target: https://github.com/AppPe
**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.
![Multiine Charts](./Resources/multiline1.gif "Multiine Charts")
<img src="https://user-images.githubusercontent.com/2826764/131211991-eca64276-cf05-423f-a78a-697c55e44bbc.gif" width="50%"></img>
Usage:
```swift
@@ -63,7 +76,6 @@ Available preset gradients:
**Full screen view called LineView!!!**
![Line Charts](./Resources/fullscreen2.gif "Line Charts")
```swift
LineView(data: [8,23,54,32,12,37,7,23,43], title: "Line chart", legend: "Full screen") // legend is optional, use optional .padding()
@@ -71,7 +83,7 @@ Available preset gradients:
Adopts to dark mode automatically
![Line Charts](./Resources/showcase3.gif "Line Charts")
<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:
@@ -93,7 +105,7 @@ You can add a line chart with the following code:
## Bar charts
![Bar Charts](./Resources/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**
@@ -171,10 +183,9 @@ You can access built-in styles:
* barChartMidnightGreenLight
* barChartMidnightGreenDark
![Midnightgreen](./Resources/midnightgreen.gif "Midnightgreen")
![Custom Charts](./Resources/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 ChartForm object:
@@ -194,10 +205,10 @@ If you want to animate back movement after completing your gesture, you set `ani
### WatchOS support for Bar charts:
![Pie Charts](./Resources/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](./Resources/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 pie chart with the following code:
Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 502 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

@@ -38,7 +38,7 @@ public struct LineChartView: View {
legend: String? = nil,
style: ChartStyle = Styles.lineChartStyleOne,
form: CGSize? = ChartForm.medium,
rateValue: Int? = 14,
rateValue: Int?,
dropShadow: Bool? = true,
valueSpecifier: String? = "%.1f") {
@@ -74,14 +74,14 @@ public struct LineChartView: View {
}
HStack {
if (self.rateValue ?? 0 != 0)
if let rateValue = self.rateValue
{
if (self.rateValue ?? 0 >= 0){
if (rateValue ?? 0 >= 0){
Image(systemName: "arrow.up")
}else{
Image(systemName: "arrow.down")
}
Text("\(self.rateValue!)%")
Text("\(rateValue!)%")
}
}
}
@@ -110,7 +110,7 @@ public struct MultiLineChartView: View {
Spacer()
GeometryReader{ geometry in
ZStack{
ForEach(0..<self.data.count) { i in
ForEach(0..<self.data.count, id: \.self) { i in
Line(data: self.data[i],
frame: .constant(geometry.frame(in: .local)),
touchLocation: self.$touchLocation,