From 95ca2f7cdc47f5766abbf5d385dc66c465c6dfe0 Mon Sep 17 00:00:00 2001 From: jess Date: Fri, 3 Apr 2026 07:08:25 -0700 Subject: [PATCH] inline axis styling in measurement data views --- .../CueIOS/Views/MeasurementDataView.swift | 141 ++++++++++++++---- 1 file changed, 108 insertions(+), 33 deletions(-) diff --git a/cue-ios/CueIOS/Views/MeasurementDataView.swift b/cue-ios/CueIOS/Views/MeasurementDataView.swift index 19dc315..65f21ac 100644 --- a/cue-ios/CueIOS/Views/MeasurementDataView.swift +++ b/cue-ios/CueIOS/Views/MeasurementDataView.swift @@ -159,8 +159,24 @@ struct EisDataView: View { } .chartXAxisLabel("Z' (Ohm)") .chartYAxisLabel("-Z'' (Ohm)") - .chartXAxis { darkAxis } - .chartYAxis { darkAxisLeading } + .chartXAxis { + AxisMarks { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } + .chartYAxis { + AxisMarks(position: .leading) { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } } private var bodeMagChart: some View { @@ -184,8 +200,24 @@ struct EisDataView: View { } .chartXAxisLabel("log10(Freq Hz)") .chartYAxisLabel("log10(|Z| Ohm)") - .chartXAxis { darkAxis } - .chartYAxis { darkAxisLeading } + .chartXAxis { + AxisMarks { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } + .chartYAxis { + AxisMarks(position: .leading) { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } } private var bodePhaseChart: some View { @@ -209,8 +241,24 @@ struct EisDataView: View { } .chartXAxisLabel("log10(Freq Hz)") .chartYAxisLabel("Phase (deg)") - .chartXAxis { darkAxis } - .chartYAxis { darkAxisLeading } + .chartXAxis { + AxisMarks { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } + .chartYAxis { + AxisMarks(position: .leading) { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } } private var eisTable: some View { @@ -295,8 +343,24 @@ struct LsvDataView: View { } .chartXAxisLabel("Voltage (mV)") .chartYAxisLabel("Current (uA)") - .chartXAxis { darkAxis } - .chartYAxis { darkAxisLeading } + .chartXAxis { + AxisMarks { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } + .chartYAxis { + AxisMarks(position: .leading) { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } } private var lsvTable: some View { @@ -376,8 +440,24 @@ struct AmpDataView: View { } .chartXAxisLabel("Time (ms)") .chartYAxisLabel("Current (uA)") - .chartXAxis { darkAxis } - .chartYAxis { darkAxisLeading } + .chartXAxis { + AxisMarks { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } + .chartYAxis { + AxisMarks(position: .leading) { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } } private var ampTable: some View { @@ -472,8 +552,24 @@ struct ClDataView: View { ]) .chartXAxisLabel("Time (ms)") .chartYAxisLabel("Current (uA)") - .chartXAxis { darkAxis } - .chartYAxis { darkAxisLeading } + .chartXAxis { + AxisMarks { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } + .chartYAxis { + AxisMarks(position: .leading) { _ in + AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) + .foregroundStyle(Color.gray.opacity(0.3)) + AxisValueLabel() + .font(.caption2) + .foregroundStyle(.secondary) + } + } .chartLegend(position: .top) } @@ -543,24 +639,3 @@ struct PhDataView: View { } } -// MARK: - Shared axis styles - -private var darkAxis: some AxisContent { - AxisMarks { _ in - AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) - .foregroundStyle(Color.gray.opacity(0.3)) - AxisValueLabel() - .font(.caption2) - .foregroundStyle(.secondary) - } -} - -private var darkAxisLeading: some AxisContent { - AxisMarks(position: .leading) { _ in - AxisGridLine(stroke: StrokeStyle(lineWidth: 0.5)) - .foregroundStyle(Color.gray.opacity(0.3)) - AxisValueLabel() - .font(.caption2) - .foregroundStyle(.secondary) - } -}