Adding a Graph

One neat thing about Physlets is that there are many different kinds, you can use more than one at a time, and they can share information. Here we'll look at how to add a graph to a motion situation.


We have to do some work, of course, to add a graph. This includes:

In the second graph, showing the y-velocity as a function of time, we added a grid to the graph with the line:
document.datagraph.setDrawGrid(true);

In the third graph, plotting Y vs. X, we've turned off the autoscale feature on both axes and specified what each of the axes should run from with the lines:

document.datagraph.setAutoscaleX(false);
document.datagraph.setAutoscaleY(false);
document.datagraph.setMinMaxX(-5,5);
document.datagraph.setMinMaxY(-5,3);