I attended WWDC22 and I was able to ask someone from the SwiftUI team regarding this. They said that Swift Charts will only be available on iOS 16 and that there are good third party libraries on github which support iOS 15 and below. They didn't specify which ones specifically but I think https://github.com/willdale/SwiftUICharts or https://github.com/AppPear/ChartView would be your best bet.
Post
Replies
Boosts
Views
Activity
Heyo! I think the issue is that you're using BarMark(x:y:) when you should be using BarMark(x:ystart:yend:) when using the chartYScale(domain:) modifier. Hope this helps!
Using your example code:
BarMark(
x: .value("name", values.name),
yStart: .value("value", values.value),
yEnd: .value("minValue", minValueYAxis)
)
.cornerRadius(5.0)
.annotation(position: .overlay, alignment: .top, spacing: 10.0) {
Text("\(values.value)")
.foregroundColor(.white)
.fontWeight(.bold)
}