<!--
{
  "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/ChartContent/annotation(position:alignment:spacing:content:)-65emh",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Swift Charts",
      "Charts"
    ],
    "preciseIdentifier" : "s:6Charts12ChartContentPAAE10annotation8position9alignment7spacing7contentQrAA18AnnotationPositionV_7SwiftUI9AlignmentV14CoreFoundation7CGFloatVSgqd__yXEtAK4ViewRd__lF"
  },
  "title" : "annotation(position:alignment:spacing:content:)"
}
-->

# annotation(position:alignment:spacing:content:)

Annotates this mark or collection of marks with a view positioned
relative to its bounds.

```
nonisolated func annotation<C>(position: AnnotationPosition = .automatic, alignment: Alignment = .center, spacing: CGFloat? = nil, @ViewBuilder content: () -> C) -> some ChartContent where C : View
```

## Parameters

`position`

The location relative to the item being annotated at which
the annotation will be placed.

`alignment`

The guide for aligning the annotation in the specified position.

`spacing`

Distance between the annotation and the annotated content, or `nil` if
you want to use the default distance.

`content`

A view builder that creates the annotation.
The builder takes one input which provides information regarding the item being annotated
such as its size.

---

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)