Update chart function