clean graphFunction js