Adding event listeners to barchart