If only showBottom is configured then this condition will not be met and it won't work as expected, no?
Shouldn't this line be 

    if ((metric.showTop && metric.showTop > 0) || (metric.showBottom && metric.showBottom > 0))

?