Plot a graphic function using canvas in HTML5 and JavaScript