Issues with Line Plot JavaScript