When making a swift Chart view and displaying data with the bar mark item stlye, and formatting the y axis scale to be in line with the range of the data, the bar marks on the chart overflow the view.
Chart(weights) { weight in
BarMark(x: .value("Date", weight.date, unit: .day),
y: .value("Weight", weight.measurement))
}
.chartYScale(domain: WeightRange())
.chartXScale(domain: [Date().addingTimeInterval(-3600*25*7*4),Date()])
.padding(.leading, 40)
.padding(.trailing, 40)
.padding(.top, 10)
.padding(.bottom, 20)
.frame(height: 200)
I’ve tried setting a frame on the view, the bar marks still overflow it. If I go back to the default y axis scale then the issue goes away.