Control CloudWatch Dashboard plot attributes, like line color?

0

I have a CloudWatch Dashboard with several widgets all with line plots breaking out the data by the same dimension. I'd like to be able to somehow control the colors (or other plotting attribute) of the line such that data in each widget's plot is easy to relate to the other widgets. For example, the plotted data lines are broken out by resource instances and I'd like all the line plots for a single instance to all be the same color.

Is this possible? If so, how to do it in the CloudWatch console and/or the Cloudwatch CLI?

Thanks,
-Kurt

klarson
已提問 5 年前檢視次數 1743 次
1 個回答
0

I found an answer to my question about controlling line color on CloudWatch Dashboard graphs in addition to labeling the breakout dimension too.

Color and label are controlled via the "Dashboard Widget Object: Rendering Properties Object Format" JSON documented here: https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html?shortFooter=true#CloudWatch-Dashboard-Properties-Metric-Widget-Object.

The JSON can be passed to the CLI at dashboard creation time as documented here: https://docs.aws.amazon.com/cli/latest/reference/cloudwatch/put-dashboard.html

Also the CloudWatch Dashboard itself allows simple JSON editing of the properties via that "Action"->"View/edit source" control on the dashboard itself.

It's pretty straight forward. The only tricky part is the documentation for setting colors says "The six-digit HTML hex color code to be used for this metric." which I didn't inherently know. There's a good reference web page for HTML color codes here: https://htmlcolorcodes.com/

Turns out it all works better than I expected.

Enjoy,
-Kurt

klarson
已回答 5 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南