Mercurial > public > stock-charts
diff Sources/StockCharts/LineChart/LineChartView.swift @ 108:f53d8b9ca92b
Custom style implemented
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 04 Jul 2021 16:40:24 +0100 |
parents | 46e874c1f459 |
children | 5057c45046c1 |
line wrap: on
line diff
--- a/Sources/StockCharts/LineChart/LineChartView.swift Mon Jun 28 14:01:13 2021 +0200 +++ b/Sources/StockCharts/LineChart/LineChartView.swift Sun Jul 04 16:40:24 2021 +0100 @@ -12,26 +12,28 @@ public var dates: [String]? public var hours: [String]? public var dragGesture: Bool? + public var style: LineChartStyle @State var showingIndicators = false @State var indexPosition = Int() - public init(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) { + public init(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?, style: LineChartStyle) { self.data = data self.dates = dates self.hours = hours self.dragGesture = dragGesture + self.style = style } public var body: some View { if !data.isEmpty { VStack { if dragGesture ?? true { - ChartLabel(data: data, dates: dates, hours: hours, indexPosition: $indexPosition) + ChartLabel(data: data, dates: dates, hours: hours, style: style, indexPosition: $indexPosition) .opacity(showingIndicators ? 1: 0) } - LineView(data: data, dates: dates, hours: hours, dragGesture: dragGesture, showingIndicators: $showingIndicators, indexPosition: $indexPosition) + LineView(data: data, dates: dates, hours: hours, dragGesture: dragGesture, style: style, showingIndicators: $showingIndicators, indexPosition: $indexPosition) } } }