diff options
Diffstat (limited to 'iCUrHealth/HealthChart.swift')
-rw-r--r-- | iCUrHealth/HealthChart.swift | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/iCUrHealth/HealthChart.swift b/iCUrHealth/HealthChart.swift new file mode 100644 index 0000000..971c8ea --- /dev/null +++ b/iCUrHealth/HealthChart.swift @@ -0,0 +1,36 @@ +// +// HealthChart.swift +// iCUrHealth +// +// Created by Gregory Sinnott on 2/10/24. +// + +import SwiftUI +import Charts + +struct HealthChart: View { + var chart: userChart + var body: some View { + switch chart.type{ + case "bar": + Chart(chart.data1) { + BarMark(x: .value("Date", $0.dateInterval), + y: .value("Count", $0.data) + ) + } + case "line": + Chart(chart.data1) { + LineMark(x: .value("Date", $0.dateInterval), + y: .value("Count", $0.data) + ) + } + default: + Text("No chart found") + } + + } +} + +//#Preview { +// HealthChart() +//} |