SwiftUI Chart scrolling on macOS

I'm running macOS 26.3 and using Xcode 26.4.

I'm trying to create a SwiftUI Chart that can scroll horizontally.

In the SwiftUI Preview, and also running the app on macOS, the chart displays a scrollbar, but the scrollbar does not respond to mouse interaction (dragging the scrollbar, or clicking in the gutters on either side of the scrollbar).

Here's the sample code:

import SwiftUI
import Charts

private struct DataPoint: Identifiable {
    let id: Int
    let x: Double
    let value: Double
}

struct ContentView: View {
    private let points: [DataPoint] = (0..<60).map { index in
        let wave = sin(Double(index) * 0.28) * 18
        let trend = Double(index) * 0.35
        return DataPoint(id: index, x: Double(index), value: 60 + wave + trend)
    }

    var body: some View {
        Chart(points) { point in
            BarMark(
                x: .value("Data Point", point.x),
                y: .value("Value", point.value)
            )
            .foregroundStyle(.blue.gradient)
        }
        .chartScrollableAxes(.horizontal)
        // Doesn't work:
        // .scrollIndicators(.hidden)  // .never also does not work
        .chartXVisibleDomain(length: 20)
        .padding()
    }
}

#Preview {
    ContentView()
}
Answered by DTS Engineer in 881876022

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. I'll check the status next time I do a sweep of forums posts where I've suggested bug reports and post any information about changes I am able to share to this thread.

Bug Reporting: How and Why? has tips on creating your bug report.

Accepted Answer

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. Please file a bug report, include a small Xcode project and some directions that can be used to reproduce the problem, and post the Feedback number here once you do. I'll check the status next time I do a sweep of forums posts where I've suggested bug reports and post any information about changes I am able to share to this thread.

Bug Reporting: How and Why? has tips on creating your bug report.

Thank you, I will file a bug report.

For anyone else that finds this, the scrollbar:

  • always shows on my Mac Mini (mouse and keyboard only)
  • does not show on my Macbook Air (trackpad)
  • automatically shows when I connect a bluetooth mouse to the Macbook Air, but still does not allow mouse interaction. When I turn off the bluetooth mouse, the scrollbar disappeared.

The trackpad allows for scrolling the chart with 2-finger swipe gestures, with or without the bluetooth mouse connected.

SwiftUI Chart scrolling on macOS
 
 
Q