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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则