---
title: "chartLegend(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/chartlegend(_:)"
---

# chartLegend(_:)

Configures the legend for charts.

## Declaration

```swift
@MainActor @preconcurrency func chartLegend(_ visibility: Visibility) -> some View

```

## Parameters

- `visibility`: The visibility of the legend.

## See Also

### Legends

- [chartLegend(position:alignment:spacing:)](swiftui/view/chartlegend(position:alignment:spacing:).md)
- [chartLegend(position:alignment:spacing:content:)](swiftui/view/chartlegend(position:alignment:spacing:content:).md)
