# Changing decimal accuracy in Color scripted field

**URL:** <https://discuss.elastic.co/t/changing-decimal-accuracy-in-color-scripted-field/76537>\
**Category:** Kibana\
**Created:** [February 26, 2017, 1:54pm UTC](https://discuss.elastic.co/t/changing-decimal-accuracy-in-color-scripted-field/76537 "2017-02-26T13:54:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oferkes](https://avatars.discourse-cdn.com/v4/letter/o/9fc29f/32.png) [@Oferkes](https://discuss.elastic.co/u/Oferkes)\
**Post date:** [February 26, 2017, 1:54pm UTC](https://discuss.elastic.co/t/changing-decimal-accuracy-in-color-scripted-field/76537/1 "2017-02-26T13:54:27Z")

</div>

Hi,

is there a way to control the accuracy of a Color scripted field, for example:  
 ![](https://us1.discourse-cdn.com/elastic/original/2X/c/c39c1aabbf36100e52fa1de1da12a0e5bb8468e6.png)  
i am intersted in showing up to 3 digits after the decimal point.  
The script for that Color scripted field is:  
doc['latency'].value/1000, where latency field is number.

Thanks,  
Ofer

---

<div class="post-metadata">

**Author:** ![Stacey\_Gammon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stacey_gammon/32/14025_2.png) [@Stacey\_Gammon](https://discuss.elastic.co/u/Stacey_Gammon)\
**Post date:** [February 27, 2017, 4:53pm UTC](https://discuss.elastic.co/t/changing-decimal-accuracy-in-color-scripted-field/76537/2 "2017-02-27T16:53:34Z")

</div>

You can use Math.Round to achieve this, just multiply by 1000, round the result, and then divide by 1000. Since you are already dividing the result by 1000 you can condense this:

```auto
Math.round(doc['latency'].value) / 1000

```

 ![](https://us1.discourse-cdn.com/elastic/original/2X/5/57fcc0fad9f4cd9ea2ce4f53d7e5e0dada8c46e7.png) ![](https://us1.discourse-cdn.com/elastic/original/2X/b/b4fa6e9fac842581c5e0048051841727e2faa4e9.png)

---

<div class="post-metadata">

**Author:** ![Oferkes](https://avatars.discourse-cdn.com/v4/letter/o/9fc29f/32.png) [@Oferkes](https://discuss.elastic.co/u/Oferkes)\
**Post date:** [March 6, 2017, 7:25pm UTC](https://discuss.elastic.co/t/changing-decimal-accuracy-in-color-scripted-field/76537/3 "2017-03-06T19:25:04Z")

</div>

Thanks, that solved the issue!

---

<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:** [April 3, 2017, 7:25pm UTC](https://discuss.elastic.co/t/changing-decimal-accuracy-in-color-scripted-field/76537/4 "2017-04-03T19:25:33Z")

</div>

Closed on April 3, 2017, 7:25pm UTC

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