comparison README.md @ 127:fc066e00f4b6

Change info files
author Dennis <dennis@denniscm.com>
date Fri, 11 Aug 2023 18:53:38 +0000
parents ee52413e6d19
children 212573e8b5d4
comparison
equal deleted inserted replaced
126:22b9e6834fc0 127:fc066e00f4b6
1
2 # stock-charts [DEPRECATED]
3
4 Now, there is a way to make charts with a native API, check -> [Charts](https://developer.apple.com/documentation/charts).
5
6 A library to display interactive charts in SwiftUI.
7
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> 8 <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>
2 9
3 # SwiftUI Stock Charts [ARCHIVED] 10 - Docs: <https://denniscm.com/proj/stock-charts.html>
4 ![Build Status](https://github.com/denniscm190/StockCharts/actions/workflows/swift.yml/badge.svg) 11 - Main repo on SourceHut: <https://git.sr.ht/~denniscmartin/stock-charts>
5 **This package is deprecated, please see [Swift Charts](https://developer.apple.com/documentation/charts)** 12 - Mirrors:
13 - Github: <https://github.com/denniscmartin/stock-charts>
14 - Gitlab: <https://gitlab.com/denniscmartin/stock-charts>
6 15
7 Display interactive stock charts easily 🎉
8
9 ## Instalation
10 - In Xcode go to `File` -> `Swift packages` -> `Add package dependency`
11 - Copy and paste `https://github.com/denniscm190/StockCharts.git`
12
13 ## Demo app
14 [**Trades** is a SwiftUI app](https://github.com/denniscm190/trades-demo) with real use cases of the StockCharts `framework`.
15
16 ## Usage
17 ```swift
18 import StockCharts
19 ```
20
21 ### Line chart
22 ```swift
23 let lineChartController = LineChartController(prices: [Double])
24 LineChartView(lineChartController: lineChartController)
25 ```
26
27 You can customise the line chart with `LineChartController`
28
29 ```swift
30 LineChartController(
31 prices: [Double],
32 dates: [String]?, // format: yy-MM-dd
33 hours: [String]?, // has to correspond to dates
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 )
54 ```
55 <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif">
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)
73 .shadow(color: Color(.gray).opacity(0.15), radius: 10)
74 .overlay(
75 VStack(alignment: .leading) {
76 Text("Dennis Concepcion")
77 .font(.title3)
78 .fontWeight(.semibold)
79
80 Text("Random guy")
81
82 CapsuleChartView(percentageOfWidth: 0.6, style: CapsuleChartStyle(capsuleColor: Color.blue))
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