changeset 91:b9aa9d7b030d

Handle input data when is empty
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sun, 06 Jun 2021 18:08:07 +0200
parents d5dc68b6d459
children 2932cb8bcee3
files Sources/StockCharts/LineChart/LineChartView.swift StockCharts.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/Sources/StockCharts/LineChart/LineChartView.swift	Sat Jun 05 18:50:36 2021 +0200
+++ b/Sources/StockCharts/LineChart/LineChartView.swift	Sun Jun 06 18:08:07 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)
         }
     }
 }
Binary file StockCharts.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed