Huge JS refactor and fixed graph axes tests