Abstract the coordinate system drawing javascript out.

Abstract the coordinate system drawing javascript out.