2D Function Plotter
Ed Mackey has created a function plotter application, which plots 2D maths functions on to a graph using canvas.

Graph plotting using canvas
The function plotter allows for scrolling, stretching and zooming with the mouse and will automatically rescale the grid lines. There are a variety of preset functions to try, or you can enter your own.


Comments
Shaun
Looking through the source code it looks as though var x is defined in the plot() method and then isnt actually used. how is the scaling being applied to xPos?
Great app though.
Posted on January 26, 2010
Ed Mackey
Shaun, the variable x, which appears unused, is actually the main “x” that’s used by the formulas being evaluated. In other words “x” is being used by the Eval() call in that plot() function (for most formulas). The other ones, xPos and yPos, are the corresponding canvas pixel locations, and their relationship to x and y are determined by the zoom and stretch levels.
Posted on January 28, 2010
Thomas
I used your code to implement a webOS app for my palm pre. I would like to publish it as a free app in the official app catolg. It goes without saying that I will refer to you and your blog. I hope you agree.
Posted on March 28, 2010
Ed Mackey
Hi Thomas, sure that sounds great! Can you post some screenshots someplace?
Posted on May 3, 2010
operaguy
works in Opera
Posted on May 12, 2010
Samuel Huang
Nice tool! Please note that
would allow the user to execute plot with the ENTER key (instead of refreshing screen). Also, for security, I think a “white list” of allowed Math.* functions and the variable “x” then then current “black list” implementation.
Posted on May 17, 2010
Related demos