Correctly applies the 'none' class to prevent hiding/showing empty legends