Fixing issue in legend.js I found while investigating
issue #171.  Turns out it's possible for a divide by zero
error to happen.