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

# annotation(position:alignment:spacing:overflowResolution: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, overflowResolution: AnnotationOverflowResolution, @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.

`overflowResolution`

How to resolve the annotation exceeding the boundary of the plot.

`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)