# Number format in Canvas

**URL:** <https://discuss.elastic.co/t/number-format-in-canvas/208046>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [November 15, 2019, 10:36am UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046 "2019-11-15T10:36:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Louw](https://avatars.discourse-cdn.com/v4/letter/_/ee7513/32.png) [@\_Louw](https://discuss.elastic.co/u/_Louw)\
**Post date:** [November 15, 2019, 10:36am UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/1 "2019-11-15T10:36:36Z")

</div>

I have a canvas visualisation made of a SQL query to count clicks on a site. This is some very high numbers.  
Can I format the column so instead of "100000" and "75000", it will be shown as "100.000" and "75.000"?

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

---

<div class="post-metadata">

**Author:** ![tims](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tims/32/46750_2.png) [@tims](https://discuss.elastic.co/u/tims)\
**Post date:** [November 15, 2019, 6:01pm UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/2 "2019-11-15T18:01:18Z")

</div>

Hi @_Louw you can do this with the [formatNumber](https://www.elastic.co/guide/en/kibana/current/canvas-function-reference.html#formatnumber_fn) function in the expression.

---

<div class="post-metadata">

**Author:** ![\_Louw](https://avatars.discourse-cdn.com/v4/letter/_/ee7513/32.png) [@\_Louw](https://discuss.elastic.co/u/_Louw)\
**Post date:** [November 19, 2019, 7:31am UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/3 "2019-11-19T07:31:16Z")

</div>

Hi @tims, I'm not quite sure on the syntax used here. I tried inserting "label={formatnumber "0.0a"}" in my code, but it doesn't work. Can you advise on what I'm doing wrong? I inserted it just before the "font" block like in the example.

Below is my code

```
filters
| timefilter column="datetime_" from="now-14d" to="now+1h"
| essql 
query="SELECT HISTOGRAM(datetime_ + INTERVAL 1 HOUR, INTERVAL 1 DAY) as dag, 
COUNT(reference_) as logins FROM \"[indexpattern]\" GROUP BY dag"
| alterColumn column="dag" type="date"
| mapColumn name="formatted_dag" fn={getCell "dag" | formatdate "D/M"}
| pointseries x="formatted_dag" y="logins"
| plot defaultStyle={seriesStyle lines=1 fill=1} xaxis={axisConfig position="bottom"} yaxis=true palette={palette "#140667" "#140667" gradient=true} 
  label={formatnumber "0.0a"}
  font={font family="Arial, sans-serif" size=14 align="left" color="#140667" weight="normal" 
underline=false italic=false}
| render css=".canvasRenderEl {
}"
```

---

<div class="post-metadata">

**Author:** ![tims](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tims/32/46750_2.png) [@tims](https://discuss.elastic.co/u/tims)\
**Post date:** [November 19, 2019, 2:22pm UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/4 "2019-11-19T14:22:00Z")

</div>

Hey @_Louw, so the `plot` function doesn't have a `label` argument like the `progress` function in the example. Maybe try and `mapColumn` with the formatted number like you did for the x axis.

Something like:

```
| mapColumn name="format_bytes" fn={getCell "total_bytes" | formatnumber "0.0a"}
| pointseries x="hour" y="format_bytes" color="host"
```

---

<div class="post-metadata">

**Author:** ![\_Louw](https://avatars.discourse-cdn.com/v4/letter/_/ee7513/32.png) [@\_Louw](https://discuss.elastic.co/u/_Louw)\
**Post date:** [November 20, 2019, 7:23am UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/5 "2019-11-20T07:23:44Z")

</div>

@tims So now I have the following code:  
| alterColumn column="timetal" type="date"  
| mapColumn name="formatted\_time" fn={getCell "timetal" | formatdate "HH"}  
| mapColumn name="format\_bytes" fn={getCell "logins" | formatnumber "0.0a"}  
| pointseries x="formatted\_time" y="format\_bytes"

And my graph looks like it sorted all the entries somehow:

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

As we are counting logins, it should look like this:

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

---

<div class="post-metadata">

**Author:** ![tims](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tims/32/46750_2.png) [@tims](https://discuss.elastic.co/u/tims)\
**Post date:** [November 20, 2019, 1:04pm UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/6 "2019-11-20T13:04:42Z")

</div>

Ah shoot, yes I forgot, it is sorting the y-axis as a string now due to the formatting. The charting library we are using is fairly limited we are hoping to provide more configuration options here in the near future.

@Catherine_Liu @corey.robertson @poff any ideas on how to format the y-axis?

---

<div class="post-metadata">

**Author:** ![\_Louw](https://avatars.discourse-cdn.com/v4/letter/_/ee7513/32.png) [@\_Louw](https://discuss.elastic.co/u/_Louw)\
**Post date:** [November 28, 2019, 8:17am UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/7 "2019-11-28T08:17:10Z")

</div>

@tims, @Catherine_Liu, @corey.robertson, @poff is there any update on this? 🙂

---

<div class="post-metadata">

**Author:** ![tims](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tims/32/46750_2.png) [@tims](https://discuss.elastic.co/u/tims)\
**Post date:** [December 2, 2019, 9:06pm UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/8 "2019-12-02T21:06:07Z")

</div>

Unfortunately, I don't think there is a way to accomplish this right now. I have filed an issue here: [https://github.com/elastic/kibana/issues/52020](https://github.com/elastic/kibana/issues/52020)

---

<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 30, 2019, 9:15pm UTC](https://discuss.elastic.co/t/number-format-in-canvas/208046/9 "2019-12-30T21:15:13Z")

</div>

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