The Grapher (as shown on the left) is a application that can be used to graph user supplied functions. It is based on the GraphPanel class that can be used in your applications. A number of examples are shown below. The Grapher like most applications of the GraphPanel class can be used as either an application or applet.
This program demonstrates the capabilities of the PreGraphPanel extension to GraphPanel. This program includes GraphPanel and ExprEvaluator.
Unfortunately this ap can not be compiled because part of the source code is missing.
GraphPanel is easy to extend because it includes two do-nothing methods extendedInit and paintExtendedPoint that are intended to be overridden. This program includes BarGraphPanel which extends GraphPanel by overriding both of them. The new paintExtendPoint method that draws a vertical bar. In addition, a new method drawBar allows the new type of data point. It is used instead of the normal moveTo and drawTo methods when sending points to the panel.
This ap can draw up to 4 user input functions. A great deal of flexibility is allowed. Parametric, logarithmic, and polar graphs are permitted. Over 30 different functions are available. The user can specify the graph's boundaries or they can calculated automatically. The user can specify colors and add titles. The resulting graphs can be printed.
Many of the Grapher related aps require numerous class files - as many as 21 for the Grapher. The GraphPanel used by all the aps requires 4 class files. The aps that can be run both as an application and as an applet require JAppletFrame and its 3 class files. In addition, the aps that allow the user to input expression require ExprEvaluater which uses 9 class files. Hence jar files are used extensively to reduce download time. Unfortunately, this complicates compiling and running those aps.
To simplify compiling and running these examples in Windows, .bat files are provided for each example:
BarGraph compile --- compile BarGraph BarGraph appletviewer --- run in the AppletViewer BarGraph jar --- run as an application using the jar file BarGraph run --- run as an application using class files BarGraph --- run as an application using class files BarGraph ? --- these instructions
The parameters like "compile" are case sensitive. The vary depending on the options for the particular example. To save loading time, use of the "jar" option is recommended whenever it is available.
*These ap are relatively simple files. As long as GraphPanel.java and EasyFormat.java are available, these files can be compiled using normal techniques. They can be run using normal java and appletviewer commands and normal techniques as an applet on a web page.
The following type of code can be used in a web page to run an applet if permitted by the browser:
<object type="application/x-java-applet" height="500" width="400"> <param name="code" value="SimpleGraphApplet" /> <param name="archive" value="SimpleGraphApplet.jar" /> <param name="permissions" value="sandbox" /> Applet failed to run. No Java plug-in was found or the applet was not signed properly. </object>**AnimatedGraph, Bezier.java, BarGraph.java, and especially Grapher.java use at least 7 supporting class files. As result, the special bat files (for Windows) are strongly recommended.
Java doc type documentation for the special classes used in these examples is available in the documentation folder.
At the time this package was written, it was rather easy to run a Java applet on a web page. Hence, in developing this package, there was a special effort to produce code that could be used as either a applet or application. Unfortunately, it was determined that it was too easy to use Java in malware. Various techniques were used to help prevent this. Currently modern browsers insist that applets are "digitally signed" to help verify they have not been altered to become malware. Unfortunately, it costs a significant amount of money to obtain a digital signature. This is not a particular problem for major Java developers but is for hobbyist like me especially since my code is freeware. Consequently, the applets have on this page have been replaced by static images. This is particularly unfortunate in the case of applets that allow user input.
Consequently, to run any of the code in this package, you will have to download the
zip file and expand it. Developers having their own digital signature can use the code
in their applet, sign it, and put it on their web pages. If you do so, it would be appreciated
if you let me know about it.
Revised: July 25, 2018