implemented mouse interaction with graph