# Histogram from array of numbers

**URL:** <https://discourse.nodered.org/t/histogram-from-array-of-numbers/41151>\
**Category:** Dashboard\
**Created:** [17 February 2021 11:28 UTC](https://discourse.nodered.org/t/histogram-from-array-of-numbers/41151 "2021-02-17T11:28:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TutanJamon](https://avatars.discourse-cdn.com/v4/letter/t/d2c977/32.png) [@TutanJamon](https://discourse.nodered.org/u/TutanJamon)\
**Post date:** [17 February 2021 11:28 UTC](https://discourse.nodered.org/t/histogram-from-array-of-numbers/41151/1 "2021-02-17T11:28:01Z")

</div>

Hello everyone,  
I have an array of numbers and I need to create a histogram with them, but I don't know how. Something like what I show in the image, where my numbers go from 0 to 6000, for example. A number should not be a bar on the graph, I need them to be more clustered because the array will be long. Thanks.

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

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [17 February 2021 16:51 UTC](https://discourse.nodered.org/t/histogram-from-array-of-numbers/41151/2 "2021-02-17T16:51:39Z")

</div>

There is currently no node I can find that will do that. That said, you could try installing a gnuplot.js and passing the data to it and creating a graph. Not as simple as using an existing ui node, but when one doesn't exist....

---

<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 February 2021 17:03 UTC](https://discourse.nodered.org/t/histogram-from-array-of-numbers/41151/3 "2021-02-17T17:03:20Z")

</div>

If you first convert your data into the values required for the bar graph then you should be able to use the standard ui chart to draw the histogram.

**[Edit]** Google found this which looks like it should be a start. [Simple histogram algorithm in Javascript - Stack Overflow](https://stackoverflow.com/questions/36266895/simple-histogram-algorithm-in-javascript)

---

<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:** [19 March 2021 17:03 UTC](https://discourse.nodered.org/t/histogram-from-array-of-numbers/41151/4 "2021-03-19T17:03:41Z")

</div>

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