Swift Charts Axis Adjustment

I am working on a Mac app that uses Swift Charts to visualize some data. I can initially plot the data fine. The problem is that I want the ability to "zoom" in on the data. to do this I change the range of the x or y axis using the following modifiers

.chartXScale(domain: xMin...xMax)

.chartYScale(domain: yMin...yMax)

I use a drag gesture to change the values of xMin and xMax for example to zoom in on the data. This does have the effect that I want but the problem is it causes the line to start moving out of the chart area like show below. I don't understand why this is happening. I thought by changing the scale it would cause only the data that is visible on the chart to be displayed.

I figured out that you need to use the .clipped() modifier to fix this.

Swift Charts Axis Adjustment
 
 
Q