add event to legend