inline axis styling in measurement data views

This commit is contained in:
jess 2026-04-03 07:08:25 -07:00
parent 6eab85af57
commit 95ca2f7cdc
1 changed files with 108 additions and 33 deletions

View File

@ -159,8 +159,24 @@ struct EisDataView: View {
} }
.chartXAxisLabel("Z' (Ohm)") .chartXAxisLabel("Z' (Ohm)")
.chartYAxisLabel("-Z'' (Ohm)") .chartYAxisLabel("-Z'' (Ohm)")
.chartXAxis { darkAxis } .chartXAxis {
.chartYAxis { darkAxisLeading } 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 { private var bodeMagChart: some View {
@ -184,8 +200,24 @@ struct EisDataView: View {
} }
.chartXAxisLabel("log10(Freq Hz)") .chartXAxisLabel("log10(Freq Hz)")
.chartYAxisLabel("log10(|Z| Ohm)") .chartYAxisLabel("log10(|Z| Ohm)")
.chartXAxis { darkAxis } .chartXAxis {
.chartYAxis { darkAxisLeading } 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 { private var bodePhaseChart: some View {
@ -209,8 +241,24 @@ struct EisDataView: View {
} }
.chartXAxisLabel("log10(Freq Hz)") .chartXAxisLabel("log10(Freq Hz)")
.chartYAxisLabel("Phase (deg)") .chartYAxisLabel("Phase (deg)")
.chartXAxis { darkAxis } .chartXAxis {
.chartYAxis { darkAxisLeading } 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 { private var eisTable: some View {
@ -295,8 +343,24 @@ struct LsvDataView: View {
} }
.chartXAxisLabel("Voltage (mV)") .chartXAxisLabel("Voltage (mV)")
.chartYAxisLabel("Current (uA)") .chartYAxisLabel("Current (uA)")
.chartXAxis { darkAxis } .chartXAxis {
.chartYAxis { darkAxisLeading } 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 { private var lsvTable: some View {
@ -376,8 +440,24 @@ struct AmpDataView: View {
} }
.chartXAxisLabel("Time (ms)") .chartXAxisLabel("Time (ms)")
.chartYAxisLabel("Current (uA)") .chartYAxisLabel("Current (uA)")
.chartXAxis { darkAxis } .chartXAxis {
.chartYAxis { darkAxisLeading } 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 { private var ampTable: some View {
@ -472,8 +552,24 @@ struct ClDataView: View {
]) ])
.chartXAxisLabel("Time (ms)") .chartXAxisLabel("Time (ms)")
.chartYAxisLabel("Current (uA)") .chartYAxisLabel("Current (uA)")
.chartXAxis { darkAxis } .chartXAxis {
.chartYAxis { darkAxisLeading } 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) .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)
}
}