I’m working with SwiftUI’s Chart and I want to display exactly 7 bars at once on the screen. Currently, with the following code snippet, I’m only able to see 3 bars at a time on my iPhone 11, and I want to adjust this so that 7 bars are visible simultaneously.
Here is my current implementation:
Chart(somethings, id: .id) { something in
BarMark(
x: .value("Shape Type", something.tag.date, unit: .day),
y: .value("Total Count", something.tag.duration)
)
.foregroundStyle(by: .value("Tag", something.tag))
}
.chartScrollableAxes(.horizontal)
I suspect that the issue might be related to the chart’s horizontal scroll behavior or the way the bars are being rendered. How can I adjust my code to ensure that exactly 7 bars are shown at once without needing to scroll?
Any help or suggestions would be greatly appreciated!
LeeM is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.