# Chart grid not evenly spaced

**URL:** <https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515>\
**Category:** General\
**Created:** [17 July 2021 08:46 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515 "2021-07-17T08:46:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryan1998](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@ryan1998](https://discourse.nodered.org/u/ryan1998)\
**Post date:** [17 July 2021 08:46 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/1 "2021-07-17T08:46:00Z")

</div>

A chart usually has 4 evenly spaced divisions.

If I do this, however:  
`node.send( {ui_control:{min:13900}} );`

And later this:  
`node.send( {ui_control:{max:14060}} );`

The chart has a non-evenly spaced grid with 5 divisions.  
 ![node-red-graph](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7beaa8ac60d1a8ff9de81f18f99474acd59b2045.png)

Any help about why this is happening would be appreciated.

---

<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:** [17 July 2021 09:01 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/2 "2021-07-17T09:01:34Z")

</div>

What happens if you put those values in explicitly in the chart setup?

---

<div class="post-metadata">

**Author:** ![ryan1998](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@ryan1998](https://discourse.nodered.org/u/ryan1998)\
**Post date:** [17 July 2021 09:24 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/3 "2021-07-17T09:24:55Z")

</div>

Colin, If I put the values explictly in the chart setup, the same thing happens:

![node-red-graph2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/a/aa89945923067541413b4a27b88001735a3d0dcd.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:** [17 July 2021 10:08 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/4 "2021-07-17T10:08:42Z")

</div>

So nothing to do with setting via ui\_control. I assume it is the way the algorithm works. It seems to put the grid lines at appropriate intervals for the range, so in this case 40 spacing and then adds the top and bottom values. If you can think of a better algorithm you could propose it. A question, what would you want to see if the range were 12345 to 13456?

---

<div class="post-metadata">

**Author:** ![ryan1998](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@ryan1998](https://discourse.nodered.org/u/ryan1998)\
**Post date:** [17 July 2021 13:09 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/5 "2021-07-17T13:09:24Z")

</div>

Colin, What is the best way to propose an improvement to the algorithm?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [17 July 2021 13:20 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/6 "2021-07-17T13:20:33Z")

</div>

It’s using the built in one in chart.is so would need to be for that. But you may be better just setting them manually yourself

---

<div class="post-metadata">

**Author:** ![ryan1998](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@ryan1998](https://discourse.nodered.org/u/ryan1998)\
**Post date:** [17 July 2021 13:33 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/7 "2021-07-17T13:33:34Z")

</div>

The issue still happens if the values are set manually.

---

<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:** [15 September 2021 13:33 UTC](https://discourse.nodered.org/t/chart-grid-not-evenly-spaced/48515/8 "2021-09-15T13:33:54Z")

</div>

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