Mercurial > public > stock-charts
annotate README.md @ 117:7cdc06d6a9cc
Update README.md
committer: GitHub <noreply@github.com>
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Mon, 09 Aug 2021 17:00:38 +0100 |
parents | 0c0d38dca6d8 |
children | 6d53542f6f9e |
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 |
117 | 4  |
77
3d4c995845fd
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
60
diff
changeset
|
5 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
|
6 |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
7 ## Instalation |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
8 - 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
|
9 - Copy and paste `https://github.com/denniscm190/StockCharts.git` |
6 | 10 |
117 | 11 ## Demo app |
12 [**Trades** is a SwiftUI app](https://github.com/denniscm190/trades-demo) with real use cases of the StockCharts `framework`. | |
13 | |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
14 ## Usage |
36 | 15 ```swift |
16 import StockCharts | |
17 ``` | |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
18 |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
19 ### Line chart |
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
20 ```swift |
117 | 21 let lineChartController = LineChartController(prices: [Double]) |
22 LineChartView(lineChartController: lineChartController) | |
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 |
117 | 25 You can customise the line chart with `LineChartController` |
26 | |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
27 ```swift |
117 | 28 LineChartController( |
29 prices: [Double], | |
30 dates: [String], | |
31 hours: [String], | |
32 labelColor: Color, | |
33 indicatorPointColor: Color, | |
34 showingIndicatorLineColor: Color, | |
35 flatTrendLineColor: Color, | |
36 uptrendLineColor: Color, | |
37 downtrendLineColor: Color, | |
38 dragGesture: Bool | |
39 ) | |
40 ``` | |
41 | |
42 To enable the drag gesture set `dragGesture` to `true` in the `LineChartController ` | |
43 | |
44 ```swift | |
45 LineChartView( | |
46 lineChartController: | |
47 LineChartController( | |
48 prices: [Double], | |
49 dragGesture: true | |
50 ) | |
51 ) | |
12
ef22b1458c15
Update README.md
Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
parents:
6
diff
changeset
|
52 ``` |
59 | 53 <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif"> |
92 | 54 |
55 ### Capsule chart | |
56 ```swift | |
57 CapsuleChartView(percentageOfWidth: CGFloat) | |
58 // percentageOfWidth: must be 0 <= x <= 1 | |
59 ``` | |
60 | |
61 #### Example | |
62 ```swift | |
63 import SwiftUI | |
64 import StockCharts | |
65 | |
66 struct ContentView: View { | |
67 var body: some View { | |
68 RoundedRectangle(cornerRadius: 25) | |
69 .frame(width: 400, height: 120) | |
70 .foregroundColor(.white) | |
106
0c0d38dca6d8
Change colours to native swiftUI
Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
parents:
92
diff
changeset
|
71 .shadow(color: Color(,.gray).opacity(0.15), radius: 10) |
92 | 72 .overlay( |
73 VStack(alignment: .leading) { | |
74 Text("Dennis Concepcion") | |
75 .font(.title3) | |
76 .fontWeight(.semibold) | |
77 | |
78 Text("Random guy") | |
79 | |
80 CapsuleChartView(percentageOfWidth: 0.6) | |
81 .padding(.top) | |
82 } | |
83 .padding() | |
84 ) | |
85 } | |
86 } | |
87 ``` | |
88 | |
89 <img width="328" alt="CapsuleChart" src="https://user-images.githubusercontent.com/66180929/120899384-c2450d80-c62f-11eb-9a56-5a03e97441d2.png"> | |
90 |