Fixed proper initialization of JS graph method