Why Raspberry pi becomes slow while running for a long time?

I have had this happen when using charts. Charts plot many point and over time those point start hogging resources. Try disabling the charts to see if that solves it.
I try to write data to the charts once every 10 minutes or even once an hour if possible to avoid massive data point being stored on the charts.
Grafana might also be your solution, it stores data point in a data base so you won't be trying to store all those data point in the browser's ram allotment.