# Canvas bar chart: is it possible to have the y-axis in a time format

**URL:** <https://discuss.elastic.co/t/canvas-bar-chart-is-it-possible-to-have-the-y-axis-in-a-time-format/283642>\
**Category:** Kibana\
**Tags:** canvas\
**Created:** [September 8, 2021, 10:08am UTC](https://discuss.elastic.co/t/canvas-bar-chart-is-it-possible-to-have-the-y-axis-in-a-time-format/283642 "2021-09-08T10:08:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hNiven](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hniven/32/94305_2.png) [@hNiven](https://discuss.elastic.co/u/hNiven)\
**Post date:** [September 8, 2021, 10:08am UTC](https://discuss.elastic.co/t/canvas-bar-chart-is-it-possible-to-have-the-y-axis-in-a-time-format/283642/1 "2021-09-08T10:08:22Z")

</div>

Hi,

I am creating a bar chart on canvas where the x-axis is in months and the y-axis is in seconds for some sort of process to be completed. I was wondering if instead of having the y-axis in seconds you can get it to be in the HH:mm:ss format or some sort of time format instead?

---

<div class="post-metadata">

**Author:** ![brianseeders](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brianseeders/32/84831_2.png) [@brianseeders](https://discuss.elastic.co/u/brianseeders)\
**Post date:** [September 8, 2021, 8:30pm UTC](https://discuss.elastic.co/t/canvas-bar-chart-is-it-possible-to-have-the-y-axis-in-a-time-format/283642/2 "2021-09-08T20:30:12Z")

</div>

Hey @hNiven,

The [formatnumber](https://www.elastic.co/guide/en/kibana/current/canvas-function-reference.html#formatnumber_fn) function in Canvas uses [Numeral.js](http://numeraljs.com/), which has a time/duration format.

If you use the format `00:00:00`, it should get you what you want.

Example:

```auto
filters
| demodata
| mapColumn "time" fn={getCell age | formatnumber "00:00:00"}
| pointseries x="age" y="time"
| render

```

![Screen Shot 2021-09-08 at 4.29.44 PM](https://us1.discourse-cdn.com/elastic/original/3X/6/9/697a5894ea1072a3ced669abd0b6d193bb1ac280.png)

Brian

---

<div class="post-metadata">

**Author:** ![hNiven](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hniven/32/94305_2.png) [@hNiven](https://discuss.elastic.co/u/hNiven)\
**Post date:** [September 9, 2021, 1:21pm UTC](https://discuss.elastic.co/t/canvas-bar-chart-is-it-possible-to-have-the-y-axis-in-a-time-format/283642/3 "2021-09-09T13:21:31Z")

</div>

Hi @brianseeders ,

thank you for the help, that has managed to get it into the correct format. To follow on from this is there any way to then have the average of the y axis by doing something like the below?

E.g.

```auto
filters
| demodata
| mapColumn "time" fn={getCell age | formatnumber "00:00:00"}
| pointseries x="age" y="mean(time)"
| render

```

when i try this an empty graph appears, am i doing anything wrong?

---

<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 7, 2021, 1:22pm UTC](https://discuss.elastic.co/t/canvas-bar-chart-is-it-possible-to-have-the-y-axis-in-a-time-format/283642/4 "2021-10-07T13:22:05Z")

</div>

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