update graph when mouse pressed or dragged.