Просмотр исходного кода

preliminary fix for y axis scaling issue with dummy chart

polscm32 aka Marvout 1 год назад
Родитель
Сommit
671df1a5a2
1 измененных файлов с 15 добавлено и 1 удалено
  1. 15 1
      FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

+ 15 - 1
FreeAPS/Sources/Modules/Home/View/Chart/MainChartView.swift

@@ -115,7 +115,10 @@ struct MainChartView: View {
     var body: some View {
         VStack {
             ZStack {
-                staticYAxisChart
+                VStack {
+                    staticYAxisChart
+                    dummyBasalChart
+                }
 
                 ScrollViewReader { scroller in
                     ScrollView(.horizontal, showsIndicators: false) {
@@ -196,6 +199,17 @@ extension MainChartView {
         .chartLegend(.hidden)
     }
 
+    private var dummyBasalChart: some View {
+        Chart {}
+            .id("DummyBasalChart")
+            .frame(height: UIScreen.main.bounds.height * 0.08)
+            .frame(width: screenSize.width - 10)
+            .chartYAxis(.hidden)
+            .chartXAxis(.hidden)
+            .chartYScale(domain: minValue ... maxValue)
+            .chartLegend(.hidden)
+    }
+
     private var mainChart: some View {
         VStack {
             Chart {