Stale data not being weeded from chart

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

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

...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.

config

Try adding in 10000 to the points option.

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.

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

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

Yep, just as soon as I get home :wink:

1 Like

Try this little flow I played with

[{"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.

Bug recorded - Stale data not being weeded from chart · Issue #755 · FlowFuse/node-red-dashboard · GitHub

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

I've added your comment to the bug report Paul

it's node-red-node-random

1 Like

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 :+1:
@joepavitt for info

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

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