Mercurial > public > stock-charts
changeset 93:2932cb8bcee3 1.2.1
Merge pull request #9 from denniscm190/dennis
Handle input data when is empty
committer: GitHub <noreply@github.com>
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sun, 06 Jun 2021 18:11:05 +0200 |
parents | 5b9859e47d3c (current diff) b9aa9d7b030d (diff) |
children | e0c0306fb079 552685d27cbe |
files | |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/Sources/StockCharts/LineChart/LineChartView.swift Sat Jun 05 18:58:16 2021 +0200 +++ b/Sources/StockCharts/LineChart/LineChartView.swift Sun Jun 06 18:11:05 2021 +0200 @@ -24,14 +24,16 @@ } public var body: some View { - VStack { - if dragGesture ?? true { - ChartLabel(data: data, dates: dates, hours: hours, indexPosition: $indexPosition) - .opacity(showingIndicators ? 1: 0) - .padding(.vertical) + if !data.isEmpty { + VStack { + if dragGesture ?? true { + ChartLabel(data: data, dates: dates, hours: hours, indexPosition: $indexPosition) + .opacity(showingIndicators ? 1: 0) + .padding(.vertical) + } + + LineView(data: data, dates: dates, hours: hours, dragGesture: dragGesture, showingIndicators: $showingIndicators, indexPosition: $indexPosition) } - - LineView(data: data, dates: dates, hours: hours, dragGesture: dragGesture, showingIndicators: $showingIndicators, indexPosition: $indexPosition) } } }