aws-cdk-lib.aws_cloudwatch.GaugeWidget

class GaugeWidget

LanguageType name
.NETAmazon.CDK.AWS.CloudWatch.GaugeWidget
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#GaugeWidget
Javasoftware.amazon.awscdk.services.cloudwatch.GaugeWidget
Pythonaws_cdk.aws_cloudwatch.GaugeWidget
TypeScript (source)aws-cdk-lib » aws_cloudwatch » GaugeWidget

Implements IWidget

Extends ConcreteWidget

A dashboard gauge widget that displays metrics.

Example

declare const dashboard: cloudwatch.Dashboard;
declare const errorAlarm: cloudwatch.Alarm;
declare const gaugeMetric: cloudwatch.Metric;

dashboard.addWidgets(new cloudwatch.GaugeWidget({
  metrics: [gaugeMetric],
  leftYAxis: {
    min: 0,
    max: 1000,
  }
}));

Initializer

new GaugeWidget(props: GaugeWidgetProps)

Parameters

  • props GaugeWidgetProps

Properties

NameTypeDescription
heightnumberThe amount of vertical grid units the widget will take up.
widthnumberThe amount of horizontal grid units the widget will take up.
warnings?string[]Any warnings that are produced as a result of putting together this widget.

height

Type: number

The amount of vertical grid units the widget will take up.


width

Type: number

The amount of horizontal grid units the widget will take up.


warnings?

Type: string[] (optional)

Any warnings that are produced as a result of putting together this widget.

Methods

NameDescription
addMetric(metric)Add another metric to the left Y axis of the GaugeWidget.
position(x, y)Place the widget at a given position.
toJson()Return the widget JSON for use in the dashboard.

addMetric(metric)

public addMetric(metric: IMetric): void

Parameters

  • metric IMetric — the metric to add.

Add another metric to the left Y axis of the GaugeWidget.


position(x, y)

public position(x: number, y: number): void

Parameters

  • x number
  • y number

Place the widget at a given position.


toJson()

public toJson(): any[]

Returns

  • any[]

Return the widget JSON for use in the dashboard.