I'm testing the the new Charts Framework from Apple with Xcode 14.0 Beta 2. But I face some strange issues when I try to scale the y-axis to some concrete values.
var body: some View {
VStack {
GroupBox("Serien") {
Chart {
ForEach(seriesData) { series in
BarMark(
x: .value("Series", series.name),
y: .value("Wert", series.value)
)
.cornerRadius(8.0)
.annotation(position: .overlay, alignment: .top, spacing: 10.0) {
Text("\(series.value)")
.foregroundColor(.white)
.fontWeight(.bold)
}
}
RuleMark(y: .value("Durchschnitt", shotResult.wrappedSeriesAsInt.mean()))
.foregroundStyle(.red)
}
.chartYScale(domain: minSeriesYAxis...maxSeriesYAxis)
.frame(height: 220, alignment: .topLeading)
}
.backgroundStyle(Color.white)
.shadow(radius: 5.0, x: 2.0, y: 2.0)
}
}
Resulting View
The LineMark or RectangleMark looks ok. But e.g. the AreaMark has the same issue.