|
@@ -79,6 +79,13 @@ struct MainChartView: View {
|
|
|
return formatter
|
|
return formatter
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private var date24Formatter: DateFormatter {
|
|
|
|
|
+ let formatter = DateFormatter()
|
|
|
|
|
+ formatter.locale = Locale(identifier: "en_US_POSIX")
|
|
|
|
|
+ formatter.setLocalizedDateFormatFromTemplate("HH")
|
|
|
|
|
+ return formatter
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private var glucoseFormatter: NumberFormatter {
|
|
private var glucoseFormatter: NumberFormatter {
|
|
|
let formatter = NumberFormatter()
|
|
let formatter = NumberFormatter()
|
|
|
formatter.numberStyle = .decimal
|
|
formatter.numberStyle = .decimal
|
|
@@ -295,10 +302,11 @@ struct MainChartView: View {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private func timeLabelsView(fullSize: CGSize) -> some View {
|
|
private func timeLabelsView(fullSize: CGSize) -> some View {
|
|
|
- ZStack {
|
|
|
|
|
|
|
+ let format = screenHours > 6 ? date24Formatter : dateFormatter
|
|
|
|
|
+ return ZStack {
|
|
|
// X time labels
|
|
// X time labels
|
|
|
ForEach(0 ..< hours + hours) { hour in
|
|
ForEach(0 ..< hours + hours) { hour in
|
|
|
- Text(dateFormatter.string(from: firstHourDate().addingTimeInterval(hour.hours.timeInterval)))
|
|
|
|
|
|
|
+ Text(format.string(from: firstHourDate().addingTimeInterval(hour.hours.timeInterval)))
|
|
|
.font(.caption)
|
|
.font(.caption)
|
|
|
.position(
|
|
.position(
|
|
|
x: firstHourPosition(viewWidth: fullSize.width) +
|
|
x: firstHourPosition(viewWidth: fullSize.width) +
|