putting legend on top layer