Mercurial > public > stock-charts
changeset 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 | d5dc68b6d459 |
children | 2932cb8bcee3 |
files | README.md |
diffstat | 1 files changed, 37 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Sat Jun 05 18:50:36 2021 +0200 +++ b/README.md Sat Jun 05 18:58:16 2021 +0200 @@ -22,7 +22,6 @@ LineChartView(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) ``` -#### Arguments ```swift data: [120.3, 121.0, 132.4, ...] dates: ["yyyy-MM-dd", "2021-01-01", "2021-01-02", ...] @@ -30,3 +29,40 @@ dragGesture: false // By default is true ``` <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif"> + +### Capsule chart +```swift +CapsuleChartView(percentageOfWidth: CGFloat) +// percentageOfWidth: must be 0 <= x <= 1 +``` + +#### Example +```swift +import SwiftUI +import StockCharts + +struct ContentView: View { + var body: some View { + RoundedRectangle(cornerRadius: 25) + .frame(width: 400, height: 120) + .foregroundColor(.white) + .shadow(color: Color(.gray).opacity(0.15), radius: 10) + .overlay( + VStack(alignment: .leading) { + Text("Dennis Concepcion") + .font(.title3) + .fontWeight(.semibold) + + Text("Random guy") + + CapsuleChartView(percentageOfWidth: 0.6) + .padding(.top) + } + .padding() + ) + } +} +``` + +<img width="328" alt="CapsuleChart" src="https://user-images.githubusercontent.com/66180929/120899384-c2450d80-c62f-11eb-9a56-5a03e97441d2.png"> +