![]() |
Examples Involving a User Interface |
There are several ways the user might be involved in creating a plot.
textarea
.
This is the very simplest use of divgraph.js.
Example i1![]() prompt for f(x) or data Execute JavaScript
| Change this code, then click on the "Execute JavaScript" link, to see the effect. |
In this case, the function is given, but the x-range values are missing.
Example i2![]() prompt for x-range Execute JavaScript
| Change this code, then click on the "Execute JavaScript" link, to see the effect. |
textarea
This example shows how a user's own x,y data can be plotted.
textarea
This example of a general plotter for titration data is from the Principal Species in Solution page. Go ahead and change the data and click on "Execute JavaScript." Lots of parameters are defined, because it is a very specific type of plot that we want.
Colors and labels can be introduced as textbox data. A vertical bar separates the "alt" label, which pops up when the mouse moves over the point, from the displayed label, which is displayed directly on the graph. This displayed label may be any valid HTML code, including forms, buttons, links, and images.
This example shows how the user might select various plotting options based on data presented. At the end of the plotting, the Info.whendone
parameter causes the function check() to be run. Can you figure out how to plot the data in order to get a straight line?
This example shows how the user might be able to enter their own data along with selecting various plotting options based on data presented. These data are kinetics data similar to what might be obtained using the Mechanism-Based Kinetics Simulator. At the end of the plotting, the Info.title
parameter includes a link to opener.check(), which allows after-plotting feedback directed by the user. These are data showing the effect of temperature on the rate constant for a chemical reaction. Can you figure out how to plot the data in order to get a straight line?
This example shows how to draw a histogram with control buttons that the user can use to start and stop animation.
This example shows how a histogram can be used to display an NMR spectrum on the fly based on data in a textarea. Mouse-down events on the graph are trapped. The only really complex aspect of the code is the getnmrdata() function, which reads the textarea information and translates it into a Data[]
array representing the NMR spectrum.
copyright 2001 Robert M. Hanson. All rights reserved. divgraph.js is freely distributable for noncomercial purposes, provided reference is made as "divgraph.js was developed at St. Olaf College by Robert M. Hanson (http://www.stolaf.edu/people/hansonr/divgraph)." Commercial licensing is available for specific purposes.