Adding legend and working on filter on click