Abstract the coordinate system drawing javascript out.