Skip to content
v2.274.0

GraphWidgetProps Struct ​

Properties for a GraphWidget.

Example ​

ts
declare const dashboard: cloudwatch.Dashboard;

dashboard.addWidgets(new cloudwatch.GraphWidget({
  // ...
  accountId: '123456789012',
}));

dashboard.addWidgets(new cloudwatch.LogQueryWidget({
  logGroupNames: ['my-log-group'],
  // ...
  accountId: '123456789012',
  queryLines: [
    'fields @message',
  ],
}));

Properties ​

accountIdoptionalstringaccount_idoptionalstraccountIdoptionalStringAccountIdoptionalstringAccountIdoptional*string#
The AWS account ID where the metrics are located.

Default: Current account

notes

This enables cross-account functionality for CloudWatch dashboards. Before using this feature, ensure that proper cross-account sharing is configured between the monitoring account and source account.

For more information, see: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html

displayLabelsOnChartoptionalbooleandisplay_labels_on_chartoptionalbooldisplayLabelsOnChartoptionalBooleanDisplayLabelsOnChartoptionalboolDisplayLabelsOnChartoptional*bool= false#
Whether the graph should show labels on the chart.

Currently only applicable for Pie charts.

endoptionalstringendoptionalstrendoptionalStringEndoptionalstringEndoptional*string#
The end of the time range to use for each widget independently from those of the dashboard.

Default: When the dashboard loads, the end date will be the current time.

If you specify a value for end, you must also specify a value for start. Specify an absolute time in the ISO 8601 format. For example, 2018-12-17T06:00:00.000Z.

heightoptionalnumberheightoptionalint | floatheightoptionalNumberHeightoptionaldoubleHeightoptional*float64#
Height of the widget.

Default: 6 for Alarm and Graph widgets. 3 for single value widgets where most recent value of a metric is displayed.

leftoptionalIMetric[]leftoptionaltyping.List[IMetric]leftoptionalList<IMetric>LeftoptionalIMetric[]Leftoptional*[]IMetric#
Metrics to display on left Y axis.

Default: No metrics

leftAnnotationsoptionalHorizontalAnnotation[]left_annotationsoptionaltyping.List[HorizontalAnnotation]leftAnnotationsoptionalList<HorizontalAnnotation>LeftAnnotationsoptionalHorizontalAnnotation[]LeftAnnotationsoptional*[]HorizontalAnnotation#
Annotations for the left Y axis.

Default: No annotations

leftYAxisoptionalYAxisPropsleft_y_axisoptionalYAxisPropsleftYAxisoptionalYAxisPropsLeftYAxisoptionalYAxisPropsLeftYAxisoptionalYAxisProps= None#
Left Y axis.
legendPositionoptionalLegendPositionlegend_positionoptionalLegendPositionlegendPositionoptionalLegendPositionLegendPositionoptionalLegendPositionLegendPositionoptionalLegendPosition= bottom#
Position of the legend.
liveDataoptionalbooleanlive_dataoptionalboolliveDataoptionalBooleanLiveDataoptionalboolLiveDataoptional*bool= false#
Whether the graph should show live data.
periodoptionalDurationperiodoptionalDurationperiodoptionalDurationPeriodoptionalDurationPeriodoptionalDuration= cdk.Duration.seconds(300)#
The default period for all metrics in this widget.

The period is the length of time represented by one data point on the graph. This default can be overridden within each metric definition.

regionoptionalstringregionoptionalstrregionoptionalStringRegionoptionalstringRegionoptional*string#
The region the metrics of this graph should be taken from.

Default: Current region

rightAnnotationsoptionalHorizontalAnnotation[]right_annotationsoptionaltyping.List[HorizontalAnnotation]rightAnnotationsoptionalList<HorizontalAnnotation>RightAnnotationsoptionalHorizontalAnnotation[]RightAnnotationsoptional*[]HorizontalAnnotation#
Annotations for the right Y axis.

Default: No annotations

rightYAxisoptionalYAxisPropsright_y_axisoptionalYAxisPropsrightYAxisoptionalYAxisPropsRightYAxisoptionalYAxisPropsRightYAxisoptionalYAxisProps= None#
Right Y axis.
setPeriodToTimeRangeoptionalbooleanset_period_to_time_rangeoptionalboolsetPeriodToTimeRangeoptionalBooleanSetPeriodToTimeRangeoptionalboolSetPeriodToTimeRangeoptional*bool= false#
Whether to show the value from the entire time range. Only applicable for Bar and Pie charts.

If false, values will be from the most recent period of your chosen time range; if true, shows the value from the entire time range.

stackedoptionalbooleanstackedoptionalboolstackedoptionalBooleanStackedoptionalboolStackedoptional*bool= false#
Whether the graph should be shown as stacked lines.
startoptionalstringstartoptionalstrstartoptionalStringStartoptionalstringStartoptional*string#
The start of the time range to use for each widget independently from those of the dashboard.

Default: When the dashboard loads, the start time will be the default time range.

notes

You can specify start without specifying end to specify a relative time range that ends with the current time. In this case, the value of start must begin with -P, and you can use M, H, D, W and M as abbreviations for minutes, hours, days, weeks and months. For example, -PT8H shows the last 8 hours and -P3M shows the last three months. You can also use start along with an end field, to specify an absolute time range. When specifying an absolute time range, use the ISO 8601 format. For example, 2018-12-17T06:00:00.000Z.

statisticoptionalstringstatisticoptionalstrstatisticoptionalStringStatisticoptionalstringStatisticoptional*string#
The default statistic to be displayed for each metric.

Default: The statistic for each metric is used

This default can be overridden within the definition of each individual metric

titleoptionalstringtitleoptionalstrtitleoptionalStringTitleoptionalstringTitleoptional*string= None#
Title for the graph.
verticalAnnotationsoptionalVerticalAnnotation[]vertical_annotationsoptionaltyping.List[VerticalAnnotation]verticalAnnotationsoptionalList<VerticalAnnotation>VerticalAnnotationsoptionalVerticalAnnotation[]VerticalAnnotationsoptional*[]VerticalAnnotation#
Annotations for the X axis.

Default: No annotations

viewoptionalGraphWidgetViewviewoptionalGraphWidgetViewviewoptionalGraphWidgetViewViewoptionalGraphWidgetViewViewoptionalGraphWidgetView= TimeSeries#
Display this metric.
widthoptionalnumberwidthoptionalint | floatwidthoptionalNumberWidthoptionaldoubleWidthoptional*float64= 6#
Width of the widget, in a grid of 24 units wide.