Mercurial > public > stock-charts
diff 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 |
line wrap: on
line diff
--- a/README.md Mon Aug 09 16:32:45 2021 +0100 +++ b/README.md Mon Aug 09 17:00:38 2021 +0100 @@ -1,17 +1,16 @@ <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> # SwiftUI Stock Charts - -[](https://swiftpackageindex.com/denniscm190/StockCharts) -[](https://swiftpackageindex.com/denniscm190/StockCharts) + Display interactive stock charts easily 🎉 -<img width="374" alt="View1-Screenshot" src="https://user-images.githubusercontent.com/66180929/116898466-b207d000-ac36-11eb-8fb6-0a4f229307db.png"> - ## Instalation - In Xcode go to `File` -> `Swift packages` -> `Add package dependency` - Copy and paste `https://github.com/denniscm190/StockCharts.git` +## Demo app +[**Trades** is a SwiftUI app](https://github.com/denniscm190/trades-demo) with real use cases of the StockCharts `framework`. + ## Usage ```swift import StockCharts @@ -19,14 +18,37 @@ ### Line chart ```swift -LineChartView(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) +let lineChartController = LineChartController(prices: [Double]) +LineChartView(lineChartController: lineChartController) ``` +You can customise the line chart with `LineChartController` + ```swift -data: [120.3, 121.0, 132.4, ...] -dates: ["yyyy-MM-dd", "2021-01-01", "2021-01-02", ...] -hours: ["10:20", "10:21", "10:22", ...] // It could be any format -dragGesture: false // By default is true +LineChartController( + prices: [Double], + dates: [String], + hours: [String], + labelColor: Color, + indicatorPointColor: Color, + showingIndicatorLineColor: Color, + flatTrendLineColor: Color, + uptrendLineColor: Color, + downtrendLineColor: Color, + dragGesture: Bool +) +``` + +To enable the drag gesture set `dragGesture` to `true` in the `LineChartController ` + +```swift +LineChartView( + lineChartController: + LineChartController( + prices: [Double], + dragGesture: true + ) +) ``` <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif">