Drawing graphs on javascript