<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/ChartScrollTargetBehavior/valueAligned(xMatching:yUnit:xMajorAlignment:yMajorAlignment:limitBehavior:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Swift Charts",
      "Charts"
    ],
    "preciseIdentifier" : "s:6Charts25ChartScrollTargetBehaviorPAAE12valueAligned9xMatching5yUnit15xMajorAlignment01yjK005limitE0AA05ValuegbcdE0V10Foundation14DateComponentsV_qd__AA0jmK0VyAL0O0VGSgAPyqd__GSgAA0mg5LimitE0VtAKRszAA9PlottableRd__SjRd__lFZ"
  },
  "title" : "valueAligned(xMatching:yUnit:xMajorAlignment:yMajorAlignment:limitBehavior:)"
}
-->

# valueAligned(xMatching:yUnit:xMajorAlignment:yMajorAlignment:limitBehavior:)

Creates a scroll target behavior that aligns to values spaced at regular intervals along the scrollable axes.

```
static func valueAligned<Y>(xMatching xComponents: DateComponents, yUnit: Y, xMajorAlignment: MajorValueAlignment<Date>? = nil, yMajorAlignment: MajorValueAlignment<Y>? = nil, limitBehavior: ValueAlignedLimitBehavior = .automatic) -> ValueAlignedChartScrollTargetBehavior where Self == ValueAlignedChartScrollTargetBehavior, Y : Plottable, Y : Numeric
```

## Parameters

`xComponents`

The alignment components for the x-axis.

`yUnit`

The alignment unit for the y-axis.

`xMajorAlignment`

The behavior for aligning to major values along the x-axis.

`yMajorAlignment`

The behavior for aligning to major values along the y-axis.

`limitBehavior`

The scroll limit behavior.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)