Mercurial > public > stock-charts
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sources/StockCharts/LineChart/LineChartController.swift Mon Aug 09 16:32:45 2021 +0100 @@ -0,0 +1,55 @@ +// +// LineChartController.swift +// StockCharts +// +// Created by Dennis Concepción Martín on 5/8/21. +// + +import SwiftUI + +public class LineChartController { + + // MARK: - Data + public var prices: [Double] + public var dates: [String]? + public var hours: [String]? + + // MARK: - Style + public var labelColor: Color + public var indicatorPointColor: Color + public var showingIndicatorLineColor: Color + public var flatTrendLineColor: Color + public var uptrendLineColor: Color + public var downtrendLineColor: Color + + // MARK: - Interactions + public var dragGesture: Bool = false + + public init( + prices: [Double], + dates: [String]? = nil, + hours: [String]? = nil, + + labelColor: Color = .blue, + indicatorPointColor: Color = .blue, + showingIndicatorLineColor: Color = .blue, + flatTrendLineColor: Color = .purple, + uptrendLineColor: Color = .green, + downtrendLineColor: Color = .red, + + dragGesture: Bool = false + ) { + self.prices = prices + self.dates = dates + self.hours = hours + + self.labelColor = labelColor + self.indicatorPointColor = indicatorPointColor + self.showingIndicatorLineColor = showingIndicatorLineColor + self.flatTrendLineColor = flatTrendLineColor + self.uptrendLineColor = uptrendLineColor + self.downtrendLineColor = downtrendLineColor + + self.dragGesture = dragGesture + } +}