# Canvas - Rounding point series axis data

**URL:** <https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [September 3, 2019, 8:09pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939 "2019-09-03T20:09:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajeev1](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rajeev1](https://discuss.elastic.co/u/rajeev1)\
**Post date:** [September 3, 2019, 8:09pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/1 "2019-09-03T20:09:09Z")

</div>

I am facing couple of issues with Canvas pointseries.

1. I am using x-axis as @timestamp and y-axis is average of a field. The issue is that sometime average can have more than 2 digits after the decimal point but the Canvas is not rounding up the value. For example, it is displaying 88.89456. Is there any way to round this value while displaying?

2. In case of no values retrieved by the query, the graph is like below image, the y-axis is starting with -1.0 instead of 0.0. Can we fix that somehow?

![image](https://us1.discourse-cdn.com/elastic/original/3X/7/5/75adc93fc40f9e1832d0d4ff1b9b1ce22f03e587.png)

EDIT : Kibana and Elastic Version :- 6.8.2  
Please let me know

---

<div class="post-metadata">

**Author:** ![Catherine\_Liu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/catherine_liu/32/34294_2.png) [@Catherine\_Liu](https://discuss.elastic.co/u/Catherine_Liu)\
**Post date:** [September 3, 2019, 8:47pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/2 "2019-09-03T20:47:08Z")

</div>

@rajeev1

1. You can use the [`round`](https://www.elastic.co/guide/en/kibana/current/canvas-tinymath-functions.html#_round_a_b) function available in TinyMath to round the number values to two decimal places. For example, `pointseries x=@timestamp y="round(mean(price),2)"`.

2. Are you talking about displaying 0 as the lower bound for the y-axis? You can set the min and max range on a number axis by passing an [`axisConfig`](https://www.elastic.co/guide/en/kibana/current/canvas-function-reference.html#axisConfig_fn) to the `yaxis` argument in the `plot` function . For example, `plot yaxis={axisConfig min=0}`

---

<div class="post-metadata">

**Author:** ![rajeev1](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rajeev1](https://discuss.elastic.co/u/rajeev1)\
**Post date:** [September 3, 2019, 9:03pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/3 "2019-09-03T21:03:55Z")

</div>

Thanks @Catherine_Liu!

I tried both before and again; but it doesnt seems working with Canvas. I tried with the timelion .yaxis(min, max) option as well, didnt work with Canvas either, worked perfectly on timelion view.

---

<div class="post-metadata">

**Author:** ![Catherine\_Liu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/catherine_liu/32/34294_2.png) [@Catherine\_Liu](https://discuss.elastic.co/u/Catherine_Liu)\
**Post date:** [September 3, 2019, 9:09pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/4 "2019-09-03T21:09:42Z")

</div>

@rajeev1 Can you share the expression on your element?

---

<div class="post-metadata">

**Author:** ![rajeev1](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rajeev1](https://discuss.elastic.co/u/rajeev1)\
**Post date:** [September 3, 2019, 9:10pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/5 "2019-09-03T21:10:17Z")

</div>

```
filters
| timelion 
  query=".es(q='SubCategory:\"SCM Tooling\"', metric=avg:Rating, index=devops-culture-05)" interval="30d"
| pointseries y="round(mean(value), 2)" x="@timestamp"
| plot defaultStyle={seriesStyle lines="2" points="0" bars="0"}
| render

```

Used for rounding, after this as well, the rounding is not happening

---

<div class="post-metadata">

**Author:** ![rajeev1](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rajeev1](https://discuss.elastic.co/u/rajeev1)\
**Post date:** [September 3, 2019, 9:11pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/6 "2019-09-03T21:11:21Z")

</div>

This is the one I am using for the MIN value

filters  
| timelion  
query=".es(index='test-index\*', q='(status:"SUCCESS") AND (metrics.new\_coverage.status:"OK")', metric=avg:metrics.new\_coverage.value)" interval="7d"  
| pointseries x="@timestamp" y="value"  
| plot defaultStyle={seriesStyle bars=0 lines=4 horizontalBars=false color="#fd1d1d"} legend=false yaxis={axisConfig min=0}  
| render

---

<div class="post-metadata">

**Author:** ![rajeev1](https://avatars.discourse-cdn.com/v4/letter/r/d26b3c/32.png) [@rajeev1](https://discuss.elastic.co/u/rajeev1)\
**Post date:** [September 4, 2019, 7:19pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/7 "2019-09-04T19:19:23Z")

</div>

@Catherine_Liu - Strangely, if I do like below it just display an empty Y axis if I dont have any data to plot. Not just 0.1 any value greater than '0' should give the same behaviour  
yaxis={axisConfig min=0.1}

---

<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:** [October 2, 2019, 7:19pm UTC](https://discuss.elastic.co/t/canvas-rounding-point-series-axis-data/197939/8 "2019-10-02T19:19:24Z")

</div>

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