# HG changeset patch # User Dennis C. M. # Date 1628524838 -3600 # Node ID 7cdc06d6a9cc316bda27dbec572c28419d71fe5a # Parent 5057c45046c1b610765c53768ce6ae0dc966e6bc Update README.md committer: GitHub diff -r 5057c45046c1 -r 7cdc06d6a9cc README.md --- 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 @@ StockCharts for SwiftUI - Display interactive stock charts easily 🎉 | Product Hunt # SwiftUI Stock Charts -![Build Status](https://github.com/denniscm190/StockCharts/actions/workflows/swift.yml/badge.svg) -[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdenniscm190%2FStockCharts%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/denniscm190/StockCharts) -[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fdenniscm190%2FStockCharts%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/denniscm190/StockCharts) +![Build Status](https://github.com/denniscm190/StockCharts/actions/workflows/swift.yml/badge.svg) Display interactive stock charts easily 🎉 -View1-Screenshot - ## 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 + ) +) ``` LineChartVideo