Swift Chart RuleMark annotation not respecting overflow resolution when using chartScrollableAxis

I'm currently in the process on making a horizontally scrollable bar chart with selection. Upon selection, I want to show an annotation attached to a RuleMark. I want to be able to show this annotation above the chart plot area since it is large and will likely cover many bars.

I'm using the overflowResolution option on the annotation with the y set to disabled; however, this does not do anything and the annotation seems pushed up inside the plot area rather than overlapping with the plot area itself. If I comment out the chartScrollableAxis modifier than the overflow resolution works as expected.

Having a similar issue. The annotation and horizontal scrolling don't work together. Enabling scrolling results in the annotation not showing up anymore.

Same issue here, trying to reproduce the example used in the WWDC 23 Presentation "Explore Pit Charts and Interactivity in SwiftCharts" and the annotation doesn't appear. I worked around that issue by setting: y: .fit(to: .chart) in the init of the overflowResolution, like:

 .annotation(position: .top, spacing: 0, overflowResolution: .init(x: .fit(to: .chart), y: .fit(to: .chart)))

Probably a SwiftUI bug given this API is only a few months old.

Thanks @Geneva0 , solved it using this

 .annotation(position: .top, spacing: 0, overflowResolution: .init(x: .fit(to: .chart), y: .fit(to: .chart)))

I have the same problem. Tried to apply a custom conditional modifier to apply chartScrollableAxes(.horizontal) only when there is no X selection, but that works as it should - just fitting all the chart content into a visible chart area when I select a value with a tap gesture. And when I lift my finger, it makes the chart scrollable again changing X axis scale to the initial state.

Apple engineers, could you please tell us whether it's possible or not to make a chart scrollable horizontally and show a RuleMark annotation above the chart at the same time? The same way Apple Health app works on Steps chart. It seems like public API available to us doesn't work the same way.

Swift Chart RuleMark annotation not respecting overflow resolution when using chartScrollableAxis
 
 
Q