Mercurial > public > stock-charts
comparison 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 |
comparison
equal
deleted
inserted
replaced
90:d5dc68b6d459 | 92:5b9859e47d3c |
---|---|
20 ### Line chart | 20 ### Line chart |
21 ```swift | 21 ```swift |
22 LineChartView(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) | 22 LineChartView(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) |
23 ``` | 23 ``` |
24 | 24 |
25 #### Arguments | |
26 ```swift | 25 ```swift |
27 data: [120.3, 121.0, 132.4, ...] | 26 data: [120.3, 121.0, 132.4, ...] |
28 dates: ["yyyy-MM-dd", "2021-01-01", "2021-01-02", ...] | 27 dates: ["yyyy-MM-dd", "2021-01-01", "2021-01-02", ...] |
29 hours: ["10:20", "10:21", "10:22", ...] // It could be any format | 28 hours: ["10:20", "10:21", "10:22", ...] // It could be any format |
30 dragGesture: false // By default is true | 29 dragGesture: false // By default is true |
31 ``` | 30 ``` |
32 <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif"> | 31 <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif"> |
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 |