# Line chart not populating data

**URL:** <https://discourse.nodered.org/t/line-chart-not-populating-data/50595>\
**Category:** Dashboard\
**Created:** [3 September 2021 19:06 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595 "2021-09-03T19:06:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [3 September 2021 19:06 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/1 "2021-09-03T19:06:37Z")

</div>

newbie here

So my flow looks like this below experimenting with two temp sensors but I cant get the chart to populate the data.

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

Would I have to feed into the chart blocks a `msg.payload` only? I think I am trying to feed in a `msg.payload.pv` its from a an API response JSON data. Is this why it isnt working?

I was trying to add in a function block to the flow to change the name, basically trim off the `.pv` at the end. But have something wrong in the javascript code below if its even needed at all...?

```auto
var msg.payload=payload.pv;

return msg;

```

Chart block:

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

---

<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 September 2021 19:24 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/2 "2021-09-03T19:24:22Z")

</div>

> [@bbartling](#):
>
> ```auto
> var msg.payload=payload.pv;
> 
> return msg;
> 
> ```

Try `msg.payload = msg.payload.pv;`

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [3 September 2021 19:27 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/3 "2021-09-03T19:27:34Z")

</div>

> [@E1cid](#):
>
> msg.payload = msg.payload.pv;

Thanks for the tip so I snapped that into the flow into 2 separate function blocks:

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

Do these looks chart for the chart setup?

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

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [3 September 2021 19:32 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/4 "2021-09-03T19:32:08Z")

</div>

Still not working... Any tips greatly appreciated...

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [3 September 2021 19:54 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/5 "2021-09-03T19:54:53Z")

</div>

Are you returning the msg at the end of the function?

Ps, is always wise to put a debug just before the thing that's not working then you'll see why it's not working.

---

<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:** [3 September 2021 22:40 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/6 "2021-09-03T22:40:45Z")

</div>

Your function should be like this - no "var".

```auto
msg.payload = msg.payload.pv;
return msg;

```

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [4 September 2021 12:36 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/7 "2021-09-04T12:36:43Z")

</div>

Thank for the tips, how much memory can dashboards hold to chart data without a database?

---

<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:** [4 September 2021 13:12 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/8 "2021-09-04T13:12:24Z")

</div>

It's the browser memory that can get out of hand since the data is held and processed by the browser not Node-Red.

Don't display more data points than the pixel width of your screen and hopefully memory use will be OK.

---

<div class="post-metadata">

**Author:** ![bbartling](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@bbartling](https://discourse.nodered.org/u/bbartling)\
**Post date:** [4 September 2021 16:50 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/9 "2021-09-04T16:50:25Z")

</div>

Got it so as long as the browser is open for the Node Red dashboard data will display? Else no data is being stored right if the browser isnt being used..?

---

<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:** [4 September 2021 20:16 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/10 "2021-09-04T20:16:40Z")

</div>

Not correct, it is also stored in the server so when the browser is opened the data will immediately be visible. However the processor overhead in the browser is much greater as it has to display the data and shuffle it down each time a new point is added.

---

<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:** [4 October 2021 20:17 UTC](https://discourse.nodered.org/t/line-chart-not-populating-data/50595/11 "2021-10-04T20:17:22Z")

</div>

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