comparison Sources/StockCharts/LineChart/LineChartController.swift @ 116:5057c45046c1

Add default initializers
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Mon, 09 Aug 2021 16:32:45 +0100
parents
children
comparison
equal deleted inserted replaced
115:f90a675e5e95 116:5057c45046c1
1 //
2 // LineChartController.swift
3 // StockCharts
4 //
5 // Created by Dennis Concepción Martín on 5/8/21.
6 //
7
8 import SwiftUI
9
10 public class LineChartController {
11
12 // MARK: - Data
13 public var prices: [Double]
14 public var dates: [String]?
15 public var hours: [String]?
16
17 // MARK: - Style
18 public var labelColor: Color
19 public var indicatorPointColor: Color
20 public var showingIndicatorLineColor: Color
21 public var flatTrendLineColor: Color
22 public var uptrendLineColor: Color
23 public var downtrendLineColor: Color
24
25 // MARK: - Interactions
26 public var dragGesture: Bool = false
27
28 public init(
29 prices: [Double],
30 dates: [String]? = nil,
31 hours: [String]? = nil,
32
33 labelColor: Color = .blue,
34 indicatorPointColor: Color = .blue,
35 showingIndicatorLineColor: Color = .blue,
36 flatTrendLineColor: Color = .purple,
37 uptrendLineColor: Color = .green,
38 downtrendLineColor: Color = .red,
39
40 dragGesture: Bool = false
41 ) {
42 self.prices = prices
43 self.dates = dates
44 self.hours = hours
45
46 self.labelColor = labelColor
47 self.indicatorPointColor = indicatorPointColor
48 self.showingIndicatorLineColor = showingIndicatorLineColor
49 self.flatTrendLineColor = flatTrendLineColor
50 self.uptrendLineColor = uptrendLineColor
51 self.downtrendLineColor = downtrendLineColor
52
53 self.dragGesture = dragGesture
54 }
55 }