Fix js error when display graphs