# HG changeset patch # User Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> # Date 1616170425 -3600 # Node ID 6254ae414a5004af4f5245b312318be577da52d2 # Parent 6b20a0109829ed0ab28ef71ae8e2f1a238cf2c61 Fix minor bugs diff -r 6b20a0109829 -r 6254ae414a50 LazyBear/UI/ChartView.swift --- a/LazyBear/UI/ChartView.swift Fri Mar 19 16:34:46 2021 +0100 +++ b/LazyBear/UI/ChartView.swift Fri Mar 19 17:13:45 2021 +0100 @@ -57,6 +57,7 @@ } } .onAppear { + self.selectedPeriod = 2 let url = getUrl(endpoint: .historicalPrices, symbol: symbol, range: "3m") request(url: url, model: [HistoricalPriceModel].self) { self.historicalPrices = $0 } } @@ -78,8 +79,7 @@ private func rangeEndpointSelector(_ value: Int) -> String { var url = "" - - + if selectedPeriod == 0 { // 1 week url = getUrl(endpoint: .historicalPrices, symbol: symbol, range: selected(interval: .oneWeek)) } else if selectedPeriod == 1 { // 1 month @@ -105,19 +105,16 @@ } private func lineViewSize() -> (CGFloat, CGFloat) { - var divisor: CGFloat = 3 + var width = deviceSize.width + var height = width / 3 // if running on iPad if UIDevice.current.userInterfaceIdiom == .pad { - divisor = 6 - } - - var width = deviceSize.width - var height = deviceSize.width / divisor - - if orientation.isLandscape { - width = deviceSize.height - height = deviceSize.height / divisor + height = width / 6 + if orientation.isLandscape { + width = deviceSize.height + height = width / 6 + } } return (width, height)