# Conditional color change in Metric Widget

**URL:** <https://discuss.elastic.co/t/conditional-color-change-in-metric-widget/120327>\
**Category:** Kibana\
**Created:** [February 17, 2018, 11:16pm UTC](https://discuss.elastic.co/t/conditional-color-change-in-metric-widget/120327 "2018-02-17T23:16:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shailesh\_Vaidya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shailesh_vaidya/32/24144_2.png) [@Shailesh\_Vaidya](https://discuss.elastic.co/u/Shailesh_Vaidya)\
**Post date:** [February 17, 2018, 11:16pm UTC](https://discuss.elastic.co/t/conditional-color-change-in-metric-widget/120327/1 "2018-02-17T23:16:06Z")

</div>

Hello,

Can we have conditional color change in Metric widget. My use case is, I have result field which can be either Success or Failure. I want to show it in Green when its Success and in Red when it failure. Also please let me know if there is any other visualization type which I can use.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [February 22, 2018, 2:43pm UTC](https://discuss.elastic.co/t/conditional-color-change-in-metric-widget/120327/2 "2018-02-22T14:43:02Z")

</div>

For numeric values you can use this. The Metric visualization has this feature now. In this case I've set ranges and colors are applied to the values;

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/9/5/95ffdbd445ab38b5812ae1d4a0aacc7b9fa6b15b.png)

But I think you might be able to use conditional formatting for strings too. I'll check on that.

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [February 22, 2018, 2:51pm UTC](https://discuss.elastic.co/t/conditional-color-change-in-metric-widget/120327/3 "2018-02-22T14:51:46Z")

</div>

Here's an example where I set the conditional formatting of my `@tags` field so that `success` is green, and `info` is blue;

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/f/0f033fefca0030e3757a49782a6bcd5d6e5c57d7.png)

And here in Discover I can see a green `success` value;

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/3/83c51a7669ae9e0064ec8917c93d2e6382bc1f45.png)

And this works in at least some visualizations like this Data Table (but note that for Discover I had to set the color conditional for the analyzed `@tags` field and for Visualizations I had to set the same color conditional formatting on the `@tags.raw` field);

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/2/0/2060fd8637f46fbed38a2b9b7ac599b03d52aa9f.png)

---

<div class="post-metadata">

**Author:** ![Shailesh\_Vaidya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shailesh_vaidya/32/24144_2.png) [@Shailesh\_Vaidya](https://discuss.elastic.co/u/Shailesh_Vaidya)\
**Post date:** [February 23, 2018, 8:07pm UTC](https://discuss.elastic.co/t/conditional-color-change-in-metric-widget/120327/4 "2018-02-23T20:07:05Z")

</div>

Thanks LeeDr. This looks promising. I will try with creating such visualization.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 23, 2018, 8:07pm UTC](https://discuss.elastic.co/t/conditional-color-change-in-metric-widget/120327/5 "2018-03-23T20:07:09Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
