# LegendPosition

The position of the legend on a GraphWidget.

- Source: [`aws-cloudwatch/lib/graph.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts#L1200)

## Example

TypeScript:

```ts
declare const dashboard: cloudwatch.Dashboard;

dashboard.addWidgets(new cloudwatch.GraphWidget({
  // ...

  legendPosition: cloudwatch.LegendPosition.RIGHT,
}));
```

Python:

```python
# dashboard: cloudwatch.Dashboard

dashboard.add_widgets(cloudwatch.GraphWidget(
    # ...

    legend_position=cloudwatch.LegendPosition.RIGHT
))
```

Java:

```java
Dashboard dashboard;

dashboard.addWidgets(GraphWidget.Builder.create()
        // ...

        .legendPosition(LegendPosition.RIGHT)
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Dashboard dashboard;

dashboard.AddWidgets(new GraphWidget(new GraphWidgetProps {
    // ...

    LegendPosition = LegendPosition.RIGHT
}));
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var dashboard Dashboard

dashboard.AddWidgets(cloudwatch.NewGraphWidget(&GraphWidgetProps{
	// ...

	LegendPosition: cloudwatch.LegendPosition_RIGHT,
}))
```

## Members

| Member | Description |
| --- | --- |
| `BOTTOM` | Legend appears below the graph (default). |
| `RIGHT` | Add shading above the annotation. |
| `HIDDEN` | Add shading below the annotation. |

## Referenced by

- [`GaugeWidgetProps`](/v2/docs/aws-cdk-lib.aws_cloudwatch.GaugeWidgetProps).legendPosition
- [`GraphWidgetProps`](/v2/docs/aws-cdk-lib.aws_cloudwatch.GraphWidgetProps).legendPosition
