update code for chart