How do I give the z-axis a color gradient ?

http://www.objective.no/slides/02-sinxy.jpg

How do I do this with a part? And more importantly, how do I generate an image file with the top view of this?

SolidworksPhotoview 360