timestamp loop solved for chart