d3.svg.axis: avoid setting invalid transform attr.

Fixes #1968.  For example, when switching from a linear scale to a
logarithmic scale, some of the exiting ticks might be positioned at
Infinity in the new scale (zero and negative numbers).  This can cause a
warning to be logged in the console due to the resulting invalid
transform attribute.  The warning doesn’t prevent the rest of the axis
from functioning normally (even though it is logged as an “error”), but
it is preferable to avoid setting invalid attributes.