Added function and listener for chart updates