Visualizing Sorting algorithms JS Canvas