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