# Stale data not being weeded from chart

**URL:** https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039
**Category:** Dashboard
**Tags:** dashboard-2
**Created:** [6 April 2024 10:58 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039 "2024-04-06T10:58:40Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [6 April 2024 10:58 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/1 "2024-04-06T10:58:40Z")

</div>

Dashboard-2 v1.7.0  
Chrome browser - up to date version

Not sure if this is an issue, or something I've created 🤨

...but I have a chart being fed data every 5 seconds, and have set the chart config to append data points and x-axis limit to 1 hour.  
When I first load the chart, or refresh the browser I get exactly that, 1 hour of data. But if I leave the browser connected, the stale data (more than 1 hour old) is not removed from the chart, as per the screenshot.

 ![chart](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/0/80cf0772b7415a3d16ee1be3489923bd372ade1e.jpeg)

![config](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/7/372ce58b23d15d1cc9533093d337841c4858c5bf.jpeg)

---

<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: [6 April 2024 11:50 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/2 "2024-04-06T11:50:28Z")

</div>

Try adding in 10000 to the points option.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [6 April 2024 12:10 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/3 "2024-04-06T12:10:17Z")

</div>

> [@zenofmud](#):
>
> Try adding in 10000

Not sure about that Paul, would it then display up to 10,000 points, or 1 hours worth of data whichever is the greater/smallest?  
That's why I left it blank and added 1 hour instead.

---

<div class="post-metadata">

### Author: ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)
#### Post date: [6 April 2024 16:25 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/4 "2024-04-06T16:25:40Z")

</div>

Think thats a bug thats been around for a while. Not sure its reported in GH though, if you dont mind doing the honours?

---

<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: [6 April 2024 17:47 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/5 "2024-04-06T17:47:06Z")

</div>

For me that caused it to work. @Paul-Reed are you going to report it?

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [6 April 2024 18:02 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/6 "2024-04-06T18:02:12Z")

</div>

> [@zenofmud](#):
>
> are you going to report it?

Yep, just as soon as I get home 😉

---

<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: [6 April 2024 18:21 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/7 "2024-04-06T18:21:15Z")

</div>

Try this little flow I played with

```auto
[{"id":"9ca6b2461422c2a6","type":"ui-chart","z":"2f464dcf4944f62e","group":"d2c4867136b89fdb","name":"","label":"chart","order":9007199254740991,"chartType":"line","category":"topic","categoryType":"msg","xAxisProperty":"","xAxisPropertyType":"msg","xAxisType":"time","yAxisProperty":"","ymin":"","ymax":"","action":"append","pointShape":"star","pointRadius":4,"showLegend":true,"removeOlder":"1","removeOlderUnit":"60","removeOlderPoints":"100","colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"width":6,"height":8,"className":"","x":490,"y":560,"wires":[[]]},{"id":"18f731fd8d23c2eb","type":"random","z":"2f464dcf4944f62e","name":"","low":1,"high":"100","inte":"true","property":"payload","x":320,"y":560,"wires":[["9ca6b2461422c2a6"]]},{"id":"acd7ecd08794350b","type":"inject","z":"2f464dcf4944f62e","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"5","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":560,"wires":[["18f731fd8d23c2eb"]]},{"id":"d2c4867136b89fdb","type":"ui-group","name":"Group Name","page":"fbb5c5f6fdf9ef6c","width":"6","height":"1","order":-1,"showTitle":true,"className":"","visible":"true","disabled":"false"},{"id":"fbb5c5f6fdf9ef6c","type":"ui-page","name":"Page Name","ui":"e662da78a987a98f","path":"/d2","icon":"home","layout":"grid","theme":"edb08c2cb16dcc54","order":-1,"className":"","visible":"true","disabled":"false"},{"id":"e662da78a987a98f","type":"ui-base","name":"Testd2","path":"/dashboard","includeClientData":true,"acceptsClientConfig":["ui-notification","ui-control"],"showPathInSidebar":false},{"id":"edb08c2cb16dcc54","type":"ui-theme","name":"Mytheme","colors":{"surface":"#ffffff","primary":"#0094ce","bgPage":"#eeeeee","groupBg":"#ffffff","groupOutline":"#cccccc"},"sizes":{"pagePadding":"12px","groupGap":"12px","groupBorderRadius":"4px","widgetGap":"12px"}}]

```

and you will see the data rolloff the chart as new data comes in once it hits the time limit.

It looks to me that if the count is greater than the number of points that would show in the time limit, only the number of points that fit in the time limit will show and new points will roll off the older points.

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [6 April 2024 18:51 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/8 "2024-04-06T18:51:33Z")

</div>

Bug recorded - [Stale data not being weeded from chart · Issue #755 · FlowFuse/node-red-dashboard · GitHub](https://github.com/FlowFuse/node-red-dashboard/issues/755)

> [@zenofmud](#):
>
> Try this little flow I played with

Your flow includes a unknown node which I don't have installed - random?

I've added your comment to the bug report Paul

---

<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: [6 April 2024 19:49 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/9 "2024-04-06T19:49:53Z")

</div>

> [@Paul-Reed](#):
>
> Your flow includes a unknown node which I don't have installed - random?

it's [node-red-node-random](https://flows.nodered.org/node/node-red-node-random)

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [6 April 2024 20:03 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/10 "2024-04-06T20:03:21Z")

</div>

> [@zenofmud](#):
>
> Try this little flow

Yes, I'm seeing the same... if I enter 100 points in the `X-axis limit` then the old points are weeded off, whilst if I delete the 100 points, then the old points continue to accumulate. Good spot 👍  
@joepavitt for info

---

<div class="post-metadata">

### Author: ![gdiana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gdiana/32/90246_2.png) [@gdiana](https://discourse.nodered.org/u/gdiana)
#### Post date: [17 April 2024 00:58 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/11 "2024-04-17T00:58:30Z")

</div>

Hi Paul,

I have exactly the same problem in that I want to create trend chart which had a fixed time axis where the old data was not appended but I found it just concertinad the data like you noted.

As @zenofmud noted I set the number of points and it acted as desired and any data greater than the number of points, or stale data, is not appended, only those points within the range.

In your case you have 1 hour wth 5 sec update period so your require 60\*60/5 =720 points which should do the trick and drop all the stale data.

This works for both the old and new dashboard chart

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [17 April 2024 08:18 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/12 "2024-04-17T08:18:49Z")

</div>

The git issue is recorded and the problem will no doubt be fixed in due course.

> <https://github.com/FlowFuse/node-red-dashboard/issues/755>
>
> \### Current Behavior
> 
> I have a chart being fed data every 5 seconds, and have se…t the chart config to append data points and x-axis limit to 1 hour.
> When I first load the chart, or refresh the browser I get exactly that, 1 hour of data. But if I leave the browser connected, the stale data (more than 1 hour old) is not removed from the chart, as per the screenshot.
> I'm concerned that if the browser was kept connected, that the amount of data (points) being stored would affect the stability of the system due to memory constraints.
> 
> !\[chart\](https://github.com/FlowFuse/node-red-dashboard/assets/973580/33f7179c-93f1-4567-9ee7-59b3565a3f6c)
> 
> !\[config\](https://github.com/FlowFuse/node-red-dashboard/assets/973580/98d2998f-fb6d-421f-a332-9e4a4e9d575c)
> 
> 
> \### Expected Behavior
> 
> I expected that chart data older than 1 hour would be removed from the chart after 1 hour, however that is not the case.
> 
> \### Steps To Reproduce
> 
> Create a chart configured as above, and leave the browser connected to the chart.
> Forum link to discussion - https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039
> 
> \### Environment
> 
> \- Dashboard version: 1.7.0
> \- Node-RED version: 3.1.8
> \- Node.js version: 20.12.0
> \- npm version: 10.5.0
> \- Platform/OS: Ubuntu on Oracle cloud server
> \- Browser: Chrome Version 123.0.6312.106 (Official Build) (64-bit) (Although same result with Edge)
> 
> 
> \### Have you provided an initial effort estimate for this issue?
> 
> I am not a FlowFuse team member

---

<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: [17 May 2024 08:19 UTC](https://discourse.nodered.org/t/stale-data-not-being-weeded-from-chart/87039/13 "2024-05-17T08:19:17Z")

</div>

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