Sorted the data for chartsjs