update legend on selected item change