How to use SwiftUI Charts in a scrollable view

I want to replace my custom chart implementation with the new SwiftUI Charts. Because I use a big dataset I want to have like 6 Bars visible in my view and the ability to scroll through the rest of the data.

My View is implemented like this:

Chart {
	ForEach(data) {
		BarMark(x: .value("Total Count", $0.value),	y: .value("Shape Type", $0.text))
		.foregroundStyle($0.color)
		}		
}

This is the amount of Bars I want to have in my view:

And this is my current view:

Did I overlook something?

Cheers Nils

Hi, did you figured it out please?

Ok, it's pretty simple. I've added ScrollView (Chart is inside) and dynamic frame (width of each row - in your case height) -> frame(width: data.count * defaultWidth)

How to use SwiftUI Charts in a scrollable view
 
 
Q