Hide the legend if the @legend[:visible] params is set to 0

Instead of check for a boolean expression, check for the numerical 0