Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Swift Charts Accessibility Grouping

SwiftUI Charts automatically groups accessibility elements on the graph (Double / Date for example) when there's a lot of data, which overrides the accessibilityLabel and value I set for each data point. This makes sense, but how do we modify the chart navigation accessibility readout when this grouping occurs?

Here's an example:

var body: some View {

    let salesData: [(Date, Double)] = [
        (Date().addingTimeInterval(-1 * 24 * 60 * 60), 1200),
        (Date().addingTimeInterval(-2 * 24 * 60 * 60), 1500),
        (Date().addingTimeInterval(-3 * 24 * 60 * 60), 1000),
        (Date().addingTimeInterval(-4 * 24 * 60 * 60), 500),
        (Date().addingTimeInterval(-5 * 24 * 60 * 60), 1500),
        (Date().addingTimeInterval(-6 * 24 * 60 * 60), 1400),
        (Date().addingTimeInterval(-7 * 24 * 60 * 60), 1300),
        (Date().addingTimeInterval(-8 * 24 * 60 * 60), 1800),
        (Date().addingTimeInterval(-9 * 24 * 60 * 60), 500),
        (Date().addingTimeInterval(-10 * 24 * 60 * 60), 800),
        (Date().addingTimeInterval(-11 * 24 * 60 * 60), 800),
        (Date().addingTimeInterval(-12 * 24 * 60 * 60), 1000),
        (Date().addingTimeInterval(-13 * 24 * 60 * 60), 1500),
        (Date().addingTimeInterval(-14 * 24 * 60 * 60), 1500),
        (Date().addingTimeInterval(-15 * 24 * 60 * 60), 900),
    ]

        Chart {
            ForEach(salesData, id: \.0) {  date, sales in
                LineMark(
                  x: .value("Foo", date),
                  y: .value("Bar", sales)
                ).accessibilityLabel("Foo: \(date.formatted(date: .abbreviated, time: .omitted)) Bar: \(sales.formatted(.currency(code: "USD")))")
              }
        }
        .accessibilityElement(children: .contain)
  }
}

I am wondering if there's a protocol, modifier.. or maybe something like UIAccessibilityContainerType.

I have the same issue but need to know a way to avoid this automatic grouping at all. Would like each column has it all accessibility value (similar to the activities chart on health app)

I have the same issue and i cannot find an API in Swift Charts to prevent this Grouping.

Swift Charts Accessibility Grouping
 
 
Q