<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Charts",
  "identifier" : "/documentation/Charts/AxisValueLabel/init(format:centered:anchor:multiLabelAlignment:collisionResolution:offsetsMarks:orientation:horizontalSpacing:verticalSpacing:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Swift Charts"
    ],
    "preciseIdentifier" : "s:6Charts14AxisValueLabelV6format8centered6anchor05multiD9Alignment19collisionResolution12offsetsMarks11orientation17horizontalSpacing08verticalP0ACys5NeverOGqd___SbSg7SwiftUI9UnitPointVSgAQ0I0VSgAA0bcd9CollisionK0VApA0bcD11OrientationV14CoreFoundation7CGFloatVSgA3_tcANRsz0Z011FormatStyleRd__AA9Plottable11FormatInputRpd__SS12FormatOutputRtd__lufc"
  },
  "title" : "init(format:centered:anchor:multiLabelAlignment:collisionResolution:offsetsMarks:orientation:horizontalSpacing:verticalSpacing:)"
}
-->

# init(format:centered:anchor:multiLabelAlignment:collisionResolution:offsetsMarks:orientation:horizontalSpacing:verticalSpacing:)

Constructs an axis value label with the given properties to display the given content.

```
nonisolated init<Format>(format: Format, centered: Bool? = nil, anchor: UnitPoint? = nil, multiLabelAlignment: Alignment? = nil, collisionResolution: AxisValueLabelCollisionResolution = .automatic, offsetsMarks: Bool? = nil, orientation: AxisValueLabelOrientation = .automatic, horizontalSpacing: CGFloat? = nil, verticalSpacing: CGFloat? = nil) where Content == Never, Format : FormatStyle, Format.FormatInput : Plottable, Format.FormatOutput == String
```

## Parameters

`format`

The format for the text.

`centered`

Whether to center the label between two axis values.
If `nil`, default to true for discrete data, false to continuous data.

`anchor`

The anchor point on the bounding box of the text element that attaches to the `position`.

`multiLabelAlignment`

How labels along the axis are aligned with each other.

`collisionResolution`

How labels that collide with others are resolved.

`offsetsMarks`

Whether to offset marks to accomodate for the space used by the label.

`orientation`

The orientation of the label.

`horizontalSpacing`

The horizontal spacing of the label.
If `nil`, a default spacing will be used.

`verticalSpacing`

The vertical spacing of the label.

---

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)