implement legend switcher