# Time format on x-axis in chart node

**URL:** <https://discourse.nodered.org/t/time-format-on-x-axis-in-chart-node/78922>\
**Category:** Dashboard\
**Created:** [3 June 2023 12:49 UTC](https://discourse.nodered.org/t/time-format-on-x-axis-in-chart-node/78922 "2023-06-03T12:49:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![john56](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@john56](https://discourse.nodered.org/u/john56)\
**Post date:** [3 June 2023 12:49 UTC](https://discourse.nodered.org/t/time-format-on-x-axis-in-chart-node/78922/1 "2023-06-03T12:49:02Z")

</div>

I'm using the Chart node to plot data retrieved from a database over a 10 minute, 1 hour, 1 day or 30 day period depending a corresponding button press.  
The X-axis label field in the node editor gives several options of time/date format including custom and automatic. The automatic option changes the format depending on the time span of the data being displayed. This is what I want but I'd like to change the given formats. e.g. I don't want seconds displayed and I want 24 hour time instead of am/pm.  
Is there a way to configure the automatic formatting of the x-axis on the chart node?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [3 June 2023 13:44 UTC](https://discourse.nodered.org/t/time-format-on-x-axis-in-chart-node/78922/2 "2023-06-03T13:44:19Z")

</div>

You should be able to use msg.ui\_control to send xformat property to the chart.

> <https://github.com/node-red/node-red-dashboard/blob/master/config-fields.md>

---

<div class="post-metadata">

**Author:** ![john56](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@john56](https://discourse.nodered.org/u/john56)\
**Post date:** [3 June 2023 23:16 UTC](https://discourse.nodered.org/t/time-format-on-x-axis-in-chart-node/78922/3 "2023-06-03T23:16:28Z")

</div>

Thanks for that @E1cid.  
I'll need to play around with that but it looks like it will do what I need.

---

<div class="post-metadata">

**Author:** ![john56](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@john56](https://discourse.nodered.org/u/john56)\
**Post date:** [4 June 2023 07:02 UTC](https://discourse.nodered.org/t/time-format-on-x-axis-in-chart-node/78922/4 "2023-06-04T07:02:52Z")

</div>

I've just added the code to use the ui\_control properties. It's exactly what I need.  
Thanks for the tip.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 June 2023 07:03 UTC](https://discourse.nodered.org/t/time-format-on-x-axis-in-chart-node/78922/5 "2023-06-18T07:03:44Z")

</div>

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