How would I draw a line and make code that would rotate the line from an axis on the center of the line?

Eg-

============X============ where X is the axis.