Home Demos

A plot of x²

This is a simple example of how to plot a graph of the function y=x2, using the JSPlot_FunctionEvaluator class to automatically evaluate a mathematical function along the horizontal axis of the plot.

You can click and drag the graph left and right, and the function evaluator will automatically recompute the sine function along the new horizontal range of the graph. This is possible because the interactiveMode option on the JSPlot_Graph instance is set to pan.

The vertical axis of the plot automatically rescales the accommodate all the data.

Source code for this page