# Cant display data in the chart node

**URL:** <https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471>\
**Category:** Dashboard\
**Created:** [15 July 2021 23:29 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471 "2021-07-15T23:29:48Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahim100](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rahim100](https://discourse.nodered.org/u/rahim100)\
**Post date:** [15 July 2021 23:29 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/1 "2021-07-15T23:29:48Z")

</div>

Humidity and temperature data isnt being shown on chart node it remains blank  
i am using this set up on local node red (PC)

 ![Screenshot_12](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/4/04a0ffba100cd1fd5f5619424f69503a62838c81.png)

with the code inside function node as follows

```auto
// Array of simulated temperatures
var temp1 = [15, 17, 18.5, 20, 21.5, 23, 24, 22.2, 19, 1];

// Array of simulated relative humidities
var humidity1 = [50, 55, 61, 68, 65, 60, 80, 70, 62, 53];

var counter1 = context.get('counter1') || 0;
counter1 = counter1 + 1;
if (counter1 > 9)
    counter1 = 0;
context.set('counter1', counter1);

msg = {
    payload:
    {
        d: {
            "temperature": temp1[counter1],
            "humidity": humidity1[counter1]
        }
    }
};
return msg;

```

This iss the Cloud application that receives messages from the simulated device (PC)

 ![Screenshot_13](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24d4d84b12fcc26e97328723587d729748773868.png)

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [15 July 2021 23:57 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/2 "2021-07-15T23:57:10Z")

</div>

Um....

> [@rahim100](#):
>
> ```auto
> var counter1 = context.get('counter1') || 0;
> counter1 = counter1 + 1;
> if (counter1 > 9)
> counter1 = 0;
> context.set('counter1', counter1);
> 
> ```

so where/when does `counter1` get incremented?

I can't see how that happens. But I'm stupid. (Ask anyone here)

Also, with the second picture where you have the `ibmiot` node and a `debug` node.

It may help if you show what the message is/contains.

---

<div class="post-metadata">

**Author:** ![MecatronicaMADE](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MecatronicaMADE](https://discourse.nodered.org/u/MecatronicaMADE)\
**Post date:** [16 July 2021 00:01 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/3 "2021-07-16T00:01:43Z")

</div>

Hi @rahim100 , and welcome to our community!! Could you share your debug sidebar, for check if the data is reciving!!

Also i can see that the IBM event node is disable, i don't know if your data is from here!!

---

<div class="post-metadata">

**Author:** ![MecatronicaMADE](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MecatronicaMADE](https://discourse.nodered.org/u/MecatronicaMADE)\
**Post date:** [16 July 2021 00:18 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/4 "2021-07-16T00:18:06Z")

</div>

i used you example to try, i share!!  
To display two or more data in the chart node, you might set a different topic for each payload, i add two change nodes to get the payload (Humidity and Temperature) and also in the same set the topic for each:

 ![Captura de pantalla 2021-07-15 a la(s) 7.15.22 p. m.](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/9/d9aa7106227c95cea3eedad4b1890d8791afe6b0.png)

![Captura de pantalla 2021-07-15 a la(s) 7.14.40 p. m.](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b287876cab8386e9cb2b8958e14b4284b65b051c.png)

![Captura de pantalla 2021-07-15 a la(s) 7.14.50 p. m.](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/4/346d66ea27e40baa43b3da67da74735146dd5494.png)

![Captura de pantalla 2021-07-15 a la(s) 7.15.17 p. m.](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/5/552173543b8f6177a87f17f4dc0a3cbecd1e1cd5.png)

JSON:

```auto
[{"id":"dc9f78188b297168","type":"tab","label":"Flow 10","disabled":false,"info":""},{"id":"7af556e468b9d410","type":"function","z":"dc9f78188b297168","name":"","func":"// Array of simulated temperatures\nvar temp1 = [15, 17, 18.5, 20, 21.5, 23, 24, 22.2, 19, 1];\n\n// Array of simulated relative humidities\nvar humidity1 = [50, 55, 61, 68, 65, 60, 80, 70, 62, 53];\n\nvar counter1 = context.get('counter1') || 0;\ncounter1 = counter1 + 1;\nif (counter1 > 9)\n counter1 = 0;\ncontext.set('counter1', counter1);\n\nmsg = {\n payload:\n {\n d: {\n \"temperature\": temp1[counter1],\n \"humidity\": humidity1[counter1]\n }\n }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":260,"wires":[["16f7758adbc438de","21901993a1fbe778","77212912fd1db75a"]]},{"id":"96f826fccb4ab9bc","type":"inject","z":"dc9f78188b297168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":260,"wires":[["7af556e468b9d410"]]},{"id":"16f7758adbc438de","type":"debug","z":"dc9f78188b297168","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":220,"wires":[]},{"id":"9c57e37be2f1561d","type":"ui_chart","z":"dc9f78188b297168","name":"","group":"ec90e75fa51bd4b5","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":730,"y":260,"wires":[[]]},{"id":"21901993a1fbe778","type":"change","z":"dc9f78188b297168","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.d.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"temperature","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":260,"wires":[["9c57e37be2f1561d"]]},{"id":"77212912fd1db75a","type":"change","z":"dc9f78188b297168","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.d.humidity","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"humidity","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":300,"wires":[["9c57e37be2f1561d"]]},{"id":"ec90e75fa51bd4b5","type":"ui_group","name":"Group 1","tab":"f6fbed9ae361a67c","order":1,"disp":true,"width":6},{"id":"f6fbed9ae361a67c","type":"ui_tab","name":"Tab 11","icon":"dashboard","order":11}]

```

In the Dashboard i can see:

![Captura de pantalla 2021-07-15 a la(s) 7.15.09 p. m.](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/d/0db9ff2f2f271552219a6d7cb61b0bf85493bfa1.png)

I hope it helps you

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [16 July 2021 04:01 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/5 "2021-07-16T04:01:05Z")

</div>

> [@Trying\_to\_learn](#):
>
> so where/when does `counter1` get incremented?

Should be here... but my JS is weak.

> [@rahim100](#):
>
> `counter1 = counter1 + 1;`

Hopefully I am not adding my name to the dunce cap 😛 But what I don't see is what makes the loop work.. or is that done by the inject node? But wouldn't the counter just start over at 0 each time then?

---

<div class="post-metadata">

**Author:** ![rahim100](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rahim100](https://discourse.nodered.org/u/rahim100)\
**Post date:** [16 July 2021 14:43 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/6 "2021-07-16T14:43:21Z")

</div>

Yeah the code is executed when i inject it 😁 don't worry I'm a noob as well

---

<div class="post-metadata">

**Author:** ![rahim100](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rahim100](https://discourse.nodered.org/u/rahim100)\
**Post date:** [16 July 2021 22:07 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/7 "2021-07-16T22:07:40Z")

</div>

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

here you go  
ibmiot node is recieving data from the flows on PC via Watson Iot

---

<div class="post-metadata">

**Author:** ![rahim100](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rahim100](https://discourse.nodered.org/u/rahim100)\
**Post date:** [16 July 2021 22:10 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/8 "2021-07-16T22:10:34Z")

</div>

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

i have enabled it now and the data is being sent from the flows in the First picture with inject node and device payload which is on my pc so the cloud application on picture 2 is recieving the humidity and temperature data but i want to display them on a chart on the cloud application i created

---

<div class="post-metadata">

**Author:** ![Gunner](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gunner/32/43582_2.png) [@Gunner](https://discourse.nodered.org/u/Gunner)\
**Post date:** [16 July 2021 22:13 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/9 "2021-07-16T22:13:27Z")

</div>

You are using Windows, so try the Snipping Tool app (type **snipping tool** in the Windows search bar) so we don't have to squint at the relevant data amongst the whole desktop.

---

<div class="post-metadata">

**Author:** ![rahim100](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rahim100](https://discourse.nodered.org/u/rahim100)\
**Post date:** [16 July 2021 22:31 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/10 "2021-07-16T22:31:24Z")

</div>

> [@MecatronicaMADE](#):
>
> ```auto
> [{"id":"dc9f78188b297168","type":"tab","label":"Flow 10","disabled":false,"info":""},{"id":"7af556e468b9d410","type":"function","z":"dc9f78188b297168","name":"","func":"// Array of simulated temperatures\nvar temp1 = [15, 17, 18.5, 20, 21.5, 23, 24, 22.2, 19, 1];\n\n// Array of simulated relative humidities\nvar humidity1 = [50, 55, 61, 68, 65, 60, 80, 70, 62, 53];\n\nvar counter1 = context.get('counter1') || 0;\ncounter1 = counter1 + 1;\nif (counter1 > 9)\n counter1 = 0;\ncontext.set('counter1', counter1);\n\nmsg = {\n payload:\n {\n d: {\n \"temperature\": temp1[counter1],\n \"humidity\": humidity1[counter1]\n }\n }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":340,"y":260,"wires":[["16f7758adbc438de","21901993a1fbe778","77212912fd1db75a"]]},{"id":"96f826fccb4ab9bc","type":"inject","z":"dc9f78188b297168","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":260,"wires":[["7af556e468b9d410"]]},{"id":"16f7758adbc438de","type":"debug","z":"dc9f78188b297168","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":550,"y":220,"wires":[]},{"id":"9c57e37be2f1561d","type":"ui_chart","z":"dc9f78188b297168","name":"","group":"ec90e75fa51bd4b5","order":0,"width":0,"height":0,"label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"outputs":1,"useDifferentColor":false,"x":730,"y":260,"wires":[[]]},{"id":"21901993a1fbe778","type":"change","z":"dc9f78188b297168","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.d.temperature","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"temperature","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":260,"wires":[["9c57e37be2f1561d"]]},{"id":"77212912fd1db75a","type":"change","z":"dc9f78188b297168","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.d.humidity","tot":"msg"},{"t":"set","p":"topic","pt":"msg","to":"humidity","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":560,"y":300,"wires":[["9c57e37be2f1561d"]]},{"id":"ec90e75fa51bd4b5","type":"ui_group","name":"Group 1","tab":"f6fbed9ae361a67c","order":1,"disp":true,"width":6},{"id":"f6fbed9ae361a67c","type":"ui_tab","name":"Tab 11","icon":"dashboard","order":11}]
> 
> ```

thanks for the reply and where do i put the json code in sorry i am new to this is it inside the function node?

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [16 July 2021 23:25 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/11 "2021-07-16T23:25:14Z")

</div>

I see the `+1` outside the loop.

But if it works, who am I to argue?

---

<div class="post-metadata">

**Author:** ![molesworth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/molesworth/32/11748_2.png) [@molesworth](https://discourse.nodered.org/u/molesworth)\
**Post date:** [16 July 2021 23:35 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/12 "2021-07-16T23:35:44Z")

</div>

Is there a loop - look again 😉

I think the loopiness is done by clicky-injecty mode...

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [16 July 2021 23:36 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/13 "2021-07-16T23:36:56Z")

</div>

Ah, yeah.

So why do it at all?

Just send the data in as it arrives.....

Anyway, thanks.

I'm not the brightest. 😉

---

<div class="post-metadata">

**Author:** ![MecatronicaMADE](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MecatronicaMADE](https://discourse.nodered.org/u/MecatronicaMADE)\
**Post date:** [17 July 2021 00:22 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/14 "2021-07-17T00:22:42Z")

</div>

Hi @rahim100 . Again to display your data on a chart, you only need add a specific **topic** for each **payload**. You can import and export your project, i recommend you read all the official Node-RED documentation, [here](https://nodered.org/docs/user-guide/editor/workspace/import-export) explain how to import a project, use it to import the JSON that i shared you.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [17 July 2021 00:42 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/15 "2021-07-17T00:42:22Z")

</div>

@rahim100  
Why are you doing that at all?

You could just send the data to the `chart` node - with different topics - and it would display.

Putting it into an _array_ seems like making work for no reason.

---

<div class="post-metadata">

**Author:** ![rahim100](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rahim100](https://discourse.nodered.org/u/rahim100)\
**Post date:** [17 July 2021 10:30 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/16 "2021-07-17T10:30:10Z")

</div>

Well the thing is the loop is for a condition which will send the message to either to the device itself or the slack when a certain temperature or humidity is reached but before that i wanted to show the data on a chart.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [17 July 2021 15:04 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/17 "2021-07-17T15:04:42Z")

</div>

Exactly what data are you sending to the chart node?  
Use a debug node and copy the value of msg.payload  
 ![Untitled 3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/c/4c0586210fbafadcce2c174d7245084095d1c445.jpeg)

---

<div class="post-metadata">

**Author:** ![rahim100](https://avatars.discourse-cdn.com/v4/letter/r/b5ac83/32.png) [@rahim100](https://discourse.nodered.org/u/rahim100)\
**Post date:** [25 July 2021 23:25 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/18 "2021-07-25T23:25:21Z")

</div>

How do you label the humidity and temp on the chart ?

---

<div class="post-metadata">

**Author:** ![MecatronicaMADE](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MecatronicaMADE](https://discourse.nodered.org/u/MecatronicaMADE)\
**Post date:** [26 July 2021 19:37 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/19 "2021-07-26T19:37:40Z")

</div>

With the msg.topic:  
change node 1 -\> msg.topic -\> Humidity  
change node 2 -\> msg.topic -\> Temperature

---

<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:** [9 August 2021 19:38 UTC](https://discourse.nodered.org/t/cant-display-data-in-the-chart-node/48471/20 "2021-08-09T19:38:10Z")

</div>

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