update graph javascript