Mercurial > public > stock-charts
comparison Sources/StockCharts/LineChart/Helpers/LinePath.swift @ 70:c19e9c03e09d
Fixing Modifying state during view update
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sat, 08 May 2021 18:47:27 +0200 |
parents | 76a8e05b3266 |
children | c37c93ba3f37 |
comparison
equal
deleted
inserted
replaced
69:76a8e05b3266 | 70:c19e9c03e09d |
---|---|
13 | 13 |
14 @Binding var pathPoints: [CGPoint] | 14 @Binding var pathPoints: [CGPoint] |
15 | 15 |
16 public func path(in rect: CGRect) -> Path { | 16 public func path(in rect: CGRect) -> Path { |
17 var path = Path() | 17 var path = Path() |
18 var pathPoints = [CGPoint]() | |
18 | 19 |
19 let normalizedData = normalize(data) | 20 let normalizedData = normalize(data) |
20 let widthBetweenDataPoints = Double(width) / Double(normalizedData.count - 1) // Remove first point | 21 let widthBetweenDataPoints = Double(width) / Double(normalizedData.count - 1) // Remove first point |
21 let initialPoint = normalizedData[0] * Double(height) | 22 let initialPoint = normalizedData[0] * Double(height) |
22 var x: Double = 0 | 23 var x: Double = 0 |