Skip to content

Commit 1346726

Browse files
author
Eugene Cheung
authored
feat(custom): add graphWidgetSetPeriodToTimeRange (#482)
Corresponds with `setPeriodToTimeRange` from [GraphWidgetProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.GraphWidgetProps.html): > Whether to show the value from the entire time range. Only applicable for Bar and Pie charts. Closes #449 --- _By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license_
1 parent 4beb259 commit 1346726

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

API.md

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/monitoring/custom/CustomMonitoring.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ export interface CustomMetricGroup {
169169
* @default BOTTOM
170170
*/
171171
readonly graphWidgetLegend?: LegendPosition;
172+
/**
173+
* @see {GraphWidgetProps.setPeriodToTimeRange}
174+
*/
175+
readonly graphWidgetSetPeriodToTimeRange?: boolean;
172176
/**
173177
* @deprecated use addToSummaryDashboard. addToSummaryDashboard will take precedence over important.
174178
* @see addToSummaryDashboard
@@ -409,6 +413,8 @@ export class CustomMonitoring extends Monitoring {
409413
leftYAxis: annotatedGroup.metricGroup.graphWidgetAxis,
410414
rightYAxis: annotatedGroup.metricGroup.graphWidgetRightAxis,
411415
legendPosition: annotatedGroup.metricGroup.graphWidgetLegend,
416+
setPeriodToTimeRange:
417+
annotatedGroup.metricGroup.graphWidgetSetPeriodToTimeRange,
412418
};
413419

414420
const widget = useAnomalyDetectionWidget

test/monitoring/custom/CustomMonitoring.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ test("snapshot test", () => {
107107
{
108108
title: "DummyGroup3",
109109
graphWidgetType: GraphWidgetType.PIE,
110+
graphWidgetSetPeriodToTimeRange: true,
110111
metrics: [
111112
// regular metric
112113
new Metric({ metricName: "DummyMetric20", namespace, dimensionsMap }),

test/monitoring/custom/__snapshots__/CustomMonitoring.test.ts.snap

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)