Post

Replies

Boosts

Views

Activity

How to show scroll bars on a Swift Chart for macOS?
(I'm using macOS 14.5 and Xcode 15.4) I have a Swift Chart on macOS that needs to scroll horizontally. Simplified version: Chart(dataPoints) { data in LineMark(x: .value("X Axis", data.x), y: .value("Y Axis", data.y)) } .chartScrollableAxes(.horizontal) .chartXVisibleDomain(length: 10) The above code works fine, except that it does not show scroll bars. On a Mac with no trackpad, this means there's no mechanism to scroll the chart. On my MacBook Pro with a trackpad, I can scroll the chart with a 2-finger swipe gesture, but there are no transient scroll bars to show the relative size of the visible part of the chart. How do I add visible scroll bars to the chart so that I can scroll on Macs with no trackpad?
0
0
328
Jul ’24