Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"QueueName"
]
},
"\"]],\"yAxis\":{\"left\":{\"max\":500,\"min\":0}}}}]}"
"\"]],\"yAxis\":{\"left\":{\"min\":0,\"max\":500}}}}]}"
]
]
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 8 additions & 9 deletions packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ export interface YAxisProps {
/**
* The min value
*
* @default 0
* @default - Auto
*/
readonly min?: number;

/**
* The max value
*
* @default - No maximum value
* @default - Auto
*/
readonly max?: number;

Expand Down Expand Up @@ -175,7 +175,7 @@ export interface GaugeWidgetProps extends MetricWidgetProps {
/**
* Left Y axis
*
* @default - None
* @default {min:0,max:100}
*/
readonly leftYAxis?: YAxisProps;

Expand Down Expand Up @@ -273,11 +273,6 @@ export class GaugeWidget extends ConcreteWidget {

public toJson(): any[] {
const metrics = allMetricsGraphJson(this.metrics, []);
const leftYAxis = {
...this.props.leftYAxis,
min: this.props.leftYAxis?.min ?? 0,
max: this.props.leftYAxis?.max ?? 100,
};
return [{
type: 'metric',
width: this.width,
Expand All @@ -291,7 +286,11 @@ export class GaugeWidget extends ConcreteWidget {
metrics: metrics.length > 0 ? metrics : undefined,
annotations: (this.props.annotations ?? []).length > 0 ? { horizontal: this.props.annotations } : undefined,
yAxis: {
left: leftYAxis ?? undefined,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined here is dead code.

left: {
min: 0,
max: 100,
...this.props.leftYAxis,
},
},
legend: this.props.legendPosition !== undefined ? { position: this.props.legendPosition } : undefined,
liveData: this.props.liveData,
Expand Down
Loading