I have a simple chart that only shows it's leading (first) and trailing (last) labels on x axis. Something like this
import SwiftUI
import Charts
// ...
Chart(data) {
}
.chartXAxis {
AxisMarks(values: [firstValue, lastValue]) { _ in
AxisValueLabel()
}
}
This works fine with few data points i.e.
But as soon as my graph grows and these labels are pushed to the "edges" of it, they get truncated like this
Is there any way to disable this behavior / force these to always show despite amount of data, what actual labels say and device screen size?
Adding AxisMarks(preset: .aligned)
fixes the issue and displays labels in full.