added legend to the grid