Color Class
A set of standard colours that can be used in annotations in a GraphWidget.
| Source | aws-cloudwatch/lib/graph.ts |
|---|---|
| Type last changed |
Example
ts
declare const dashboard: cloudwatch.Dashboard;
dashboard.addWidgets(new cloudwatch.GraphWidget({
// ...
leftAnnotations: [
{ value: 1800, label: Duration.minutes(30).toHumanString(), color: cloudwatch.Color.RED, },
{ value: 3600, label: '1 hour', color: '#2ca02c', }
],
verticalAnnotations: [
{ date: '2022-10-19T00:00:00Z', label: 'Deployment', color: cloudwatch.Color.RED, }
]
}));
python
# dashboard: cloudwatch.Dashboard
dashboard.add_widgets(cloudwatch.GraphWidget(
# ...
left_annotations=[cloudwatch.HorizontalAnnotation(value=1800, label=Duration.minutes(30).to_human_string(), color=cloudwatch.Color.RED), cloudwatch.HorizontalAnnotation(value=3600, label="1 hour", color="#2ca02c")
],
vertical_annotations=[cloudwatch.VerticalAnnotation(date="2022-10-19T00:00:00Z", label="Deployment", color=cloudwatch.Color.RED)
]
))
java
Dashboard dashboard;
dashboard.addWidgets(GraphWidget.Builder.create()
// ...
.leftAnnotations(List.of(HorizontalAnnotation.builder().value(1800).label(Duration.minutes(30).toHumanString()).color(Color.RED).build(), HorizontalAnnotation.builder().value(3600).label("1 hour").color("#2ca02c").build()))
.verticalAnnotations(List.of(VerticalAnnotation.builder().date("2022-10-19T00:00:00Z").label("Deployment").color(Color.RED).build()))
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Dashboard dashboard;
dashboard.AddWidgets(new GraphWidget(new GraphWidgetProps {
// ...
LeftAnnotations = new [] { new HorizontalAnnotation { Value = 1800, Label = Duration.Minutes(30).ToHumanString(), Color = Color.RED }, new HorizontalAnnotation { Value = 3600, Label = "1 hour", Color = "#2ca02c" } },
VerticalAnnotations = new [] { new VerticalAnnotation { Date = "2022-10-19T00:00:00Z", Label = "Deployment", Color = Color.RED } }
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var dashboard Dashboard
dashboard.AddWidgets(cloudwatch.NewGraphWidget(&GraphWidgetProps{
// ...
LeftAnnotations: []HorizontalAnnotation{
&HorizontalAnnotation{
Value: jsii.Number(1800),
Label: awscdk.Duration_Minutes(jsii.Number(30)).ToHumanString(),
Color: cloudwatch.Color_RED(),
},
&HorizontalAnnotation{
Value: jsii.Number(3600),
Label: jsii.String("1 hour"),
Color: jsii.String("#2ca02c"),
},
},
VerticalAnnotations: []VerticalAnnotation{
&VerticalAnnotation{
Date: jsii.String("2022-10-19T00:00:00Z"),
Label: jsii.String("Deployment"),
Color: cloudwatch.Color_RED(),
},
},
}))
Properties
blue - hex #1f77b4.
brown - hex #8c564b.
green - hex #2ca02c.
grey - hex #7f7f7f.
orange - hex #ff7f0e.
pink - hex #e377c2.
purple - hex #9467bd.
red - hex #d62728.