legend and primitive zoom function added