Calculating barchartData on a bad way. Chris' approach much better.
Also res.end() in saveStats was missing. Before the clients request was timing out.