Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add SetPeriodToTimeRange to GraphWidget #13776

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/@aws-cdk/aws-cloudwatch/lib/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,13 @@ export interface GraphWidgetProps extends MetricWidgetProps {
* @default TimeSeries
*/
readonly view?: GraphWidgetView;

/**
* Whether to show the value from the entire time range.
*
* @default false
*/
readonly setPeriodToTimeRange?: boolean;
}

/**
Expand Down Expand Up @@ -276,6 +283,7 @@ export class GraphWidget extends ConcreteWidget {
},
legend: this.props.legendPosition !== undefined ? { position: this.props.legendPosition } : undefined,
liveData: this.props.liveData,
setPeriodToTimeRange: this.props.setPeriodToTimeRange,
},
}];
}
Expand Down
5 changes: 4 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/test/test.graphs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ import { Test } from 'nodeunit';
import { Alarm, AlarmWidget, Color, GraphWidget, GraphWidgetView, LegendPosition, LogQueryWidget, Metric, Shading, SingleValueWidget, LogQueryVisualizationType } from '../lib';

export = {
'add stacked property to graphs'(test: Test) {
'add stacked and setPeriodToTimeRange properties to graphs'(test: Test) {
// WHEN
const stack = new Stack();
const widget = new GraphWidget({
title: 'Test widget',
stacked: true,
setPeriodToTimeRange: true
});

// THEN
Expand All @@ -22,12 +23,14 @@ export = {
region: { Ref: 'AWS::Region' },
stacked: true,
yAxis: {},
setPeriodToTimeRange: true
},
}]);

test.done();
},


'add metrics to graphs on either axis'(test: Test) {
// WHEN
const stack = new Stack();
Expand Down