Changing decimal accuracy in Color scripted field

Hi,

is there a way to control the accuracy of a Color scripted field, for example:

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

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:

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

Thanks, that solved the issue!

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