# Canvas progress wheel conditional color based on negative values?

**URL:** https://discuss.elastic.co/t/canvas-progress-wheel-conditional-color-based-on-negative-values/208199
**Category:** Kibana
**Tags:** canvas
**Created:** [November 17, 2019, 6:05am UTC](https://discuss.elastic.co/t/canvas-progress-wheel-conditional-color-based-on-negative-values/208199 "2019-11-17T06:05:05Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Turker\_Topal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/turker_topal/32/45166_2.png) [@Turker\_Topal](https://discuss.elastic.co/u/Turker_Topal)
#### Post date: [November 17, 2019, 6:05am UTC](https://discuss.elastic.co/t/canvas-progress-wheel-conditional-color-based-on-negative-values/208199/1 "2019-11-17T06:05:06Z")

</div>

Hi,

I am building a dashboard for solar energy monitoring. One of the metrics is showing if you are consuming energy from grid (positive values) or feeding energy into grid (negative values). I want to change the color of progress wheel based on this but it doesn't work with negative numbers.

Basically what I want to do is

```
filters
| essql query="SELECT last(GridPowerConsumption) as gpc FROM solar"
| math "gpc/30000"
| progress shape="wheel" label={formatnumber "0%"} valueColor={if {gte 0.0} then="red" else="green"}
......

```

Any chance to make it work?

I guess it would be nice to have wheel progressing in the opposite direction if the value is negative.

---

<div class="post-metadata">

### Author: ![Turker\_Topal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/turker_topal/32/45166_2.png) [@Turker\_Topal](https://discuss.elastic.co/u/Turker_Topal)
#### Post date: [November 17, 2019, 9:29pm UTC](https://discuss.elastic.co/t/canvas-progress-wheel-conditional-color-based-on-negative-values/208199/2 "2019-11-17T21:29:37Z")

</div>

In the expense of doubling the queries, I can get it to work but I dont think this is the best way:

```
filters
| essql query="SELECT last(GridPowerConsumption) as gpc FROM solar"
| math "abs(gpc/30000)"
| progress shape="wheel" label={formatnumber "0%"} valueColor={filters
| essql query="SELECT last(GridPowerConsumption) as gps FROM solar"
| math "gps" if {gte 0.0} then="red" else="green"}
......
```

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [November 19, 2019, 4:10am UTC](https://discuss.elastic.co/t/canvas-progress-wheel-conditional-color-based-on-negative-values/208199/3 "2019-11-19T04:10:44Z")

</div>

ES uses a cache for queries, so there won't be that much of perfomance hit on the cluster, and as long as that solution does what you want, it should be fine.

---

<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: [December 17, 2019, 4:10am UTC](https://discuss.elastic.co/t/canvas-progress-wheel-conditional-color-based-on-negative-values/208199/4 "2019-12-17T04:10:49Z")

</div>

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