# Evenly Spaced Chart Axis

**URL:** <https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242>\
**Category:** Dashboard\
**Tags:** function-node, ui-chart\
**Created:** [2 October 2025 18:16 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242 "2025-10-02T18:16:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![CJS](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@CJS](https://discourse.nodered.org/u/CJS)\
**Post date:** [2 October 2025 18:16 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242/1 "2025-10-02T18:16:26Z")

</div>

I'm just curious if there's a way to have the X-axis of my chart display the date and time each data point was recorded, while keeping the spacing between points even—so there aren’t large gaps when data is collected irregularly (e.g., every hour or every few days). I've included the function block that feeds the chart, the chart itself, and the chart setup. Any information or help on this would be appreciated!

```auto
flow.set('selectedPart', msg.payload)

const selectedPart = flow.get('selectedPart') || '';
const productionQuery = flow.get('productionQuery') || [];

let result = [];

if (selectedPart === "") {
    result = productionQuery;
} else {
    productionQuery.forEach(item => {
        if (item.PartNumber === selectedPart) {
            result.push({
                Weight: item.Weight, 
                Date: item.Date_and_Time
                }); 
        }
    });
}

msg.topic = selectedPart
msg.payload = result;
msg.selectedValue = selectedPart
return msg;

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5b8e925c3f986bbbc5808193a4890523a4bcfebc.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/3/635e1e8acee9a0e9d17b1705fa45942b903c1cf2.png)

---

<div class="post-metadata">

**Author:** ![CJS](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@CJS](https://discourse.nodered.org/u/CJS)\
**Post date:** [2 October 2025 19:25 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242/2 "2025-10-02T19:25:45Z")

</div>

Currently supplementing by using the bar chart and sending the dates in as categories. Not ideal but it works.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/b/3b018836f712784e9c825ae1d5f9c838bf720280.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 October 2025 19:33 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242/3 "2025-10-02T19:33:29Z")

</div>

You can set the axis type to categorical with a line chart, which if I understand correctly is what you want. Make sure the date entries are strings.

---

<div class="post-metadata">

**Author:** ![CJS](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@CJS](https://discourse.nodered.org/u/CJS)\
**Post date:** [2 October 2025 19:35 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242/4 "2025-10-02T19:35:36Z")

</div>

I thought that was an option, but I am only seeing time scale and linear as an option

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/e/ae557faa4d7868a0fac9cd304fc10f3cf52d1f41.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [2 October 2025 20:26 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242/5 "2025-10-02T20:26:54Z")

</div>

Update to the latest version of the dashboard (1.28.0). This was introduced recently.

---

<div class="post-metadata">

**Author:** ![CJS](https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/32.png) [@CJS](https://discourse.nodered.org/u/CJS)\
**Post date:** [2 October 2025 20:29 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242/6 "2025-10-02T20:29:13Z")

</div>

Thanks didn't notice there was an update available.

---

<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:** [16 October 2025 20:29 UTC](https://discourse.nodered.org/t/evenly-spaced-chart-axis/99242/7 "2025-10-16T20:29:26Z")

</div>

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