Mercurial > public > stock-charts
annotate README.md @ 92:5b9859e47d3c 1.2.0
Update README.md
committer: GitHub <noreply@github.com>
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sat, 05 Jun 2021 18:58:16 +0200 |
parents | 455e3bcdb510 |
children | 0c0d38dca6d8 |
rev | line source |
---|---|
79 | 1 <a href="https://www.producthunt.com/posts/stockcharts-for-swiftui?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-stockcharts-for-swiftui" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=295975&theme=dark" alt="StockCharts for SwiftUI - Display interactive stock charts easily 🎉 | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a> |
45 | 2 |
23
cf68e93882b4
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
22
diff
changeset
|
3 # SwiftUI Stock Charts |
84 | 4  |
5 [](https://swiftpackageindex.com/denniscm190/StockCharts) | |
6 [](https://swiftpackageindex.com/denniscm190/StockCharts) | |
77
3d4c995845fd
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
60
diff
changeset
|
7 Display interactive stock charts easily 🎉 |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
8 |
58 | 9 <img width="374" alt="View1-Screenshot" src="https://user-images.githubusercontent.com/66180929/116898466-b207d000-ac36-11eb-8fb6-0a4f229307db.png"> |
10 | |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
11 ## Instalation |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
12 - In Xcode go to `File` -> `Swift packages` -> `Add package dependency` |
22
5c9f74baee88
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
21
diff
changeset
|
13 - Copy and paste `https://github.com/denniscm190/StockCharts.git` |
6 | 14 |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
15 ## Usage |
36 | 16 ```swift |
17 import StockCharts | |
18 ``` | |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
19 |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
20 ### Line chart |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
21 ```swift |
60
e16e6bdaa31d
Add dragGesture argument
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
59
diff
changeset
|
22 LineChartView(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
23 ``` |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
24 |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
25 ```swift |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
26 data: [120.3, 121.0, 132.4, ...] |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
27 dates: ["yyyy-MM-dd", "2021-01-01", "2021-01-02", ...] |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
28 hours: ["10:20", "10:21", "10:22", ...] // It could be any format |
60
e16e6bdaa31d
Add dragGesture argument
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
59
diff
changeset
|
29 dragGesture: false // By default is true |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
30 ``` |
59 | 31 <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif"> |
92 | 32 |
33 ### Capsule chart | |
34 ```swift | |
35 CapsuleChartView(percentageOfWidth: CGFloat) | |
36 // percentageOfWidth: must be 0 <= x <= 1 | |
37 ``` | |
38 | |
39 #### Example | |
40 ```swift | |
41 import SwiftUI | |
42 import StockCharts | |
43 | |
44 struct ContentView: View { | |
45 var body: some View { | |
46 RoundedRectangle(cornerRadius: 25) | |
47 .frame(width: 400, height: 120) | |
48 .foregroundColor(.white) | |
49 .shadow(color: Color(.gray).opacity(0.15), radius: 10) | |
50 .overlay( | |
51 VStack(alignment: .leading) { | |
52 Text("Dennis Concepcion") | |
53 .font(.title3) | |
54 .fontWeight(.semibold) | |
55 | |
56 Text("Random guy") | |
57 | |
58 CapsuleChartView(percentageOfWidth: 0.6) | |
59 .padding(.top) | |
60 } | |
61 .padding() | |
62 ) | |
63 } | |
64 } | |
65 ``` | |
66 | |
67 <img width="328" alt="CapsuleChart" src="https://user-images.githubusercontent.com/66180929/120899384-c2450d80-c62f-11eb-9a56-5a03e97441d2.png"> | |
68 |