How do you use these classes?
All that's necessary to use these classes to plot large quantities of data is to:
- Instantiate a plotting object of type PlotALot01 , PlotALot02 , PlotALot03 or PlotALot04 .
- Feed the data values that need to be plotted to the plotting object as they become available.
- Call a method named plotData on the plotting object when all of the data has been fed to the object.
It couldn't be easier
The choice among the four classes listed above depends on whether you need to plot one, two, or three channels of data, and the format in which you want toplot the data. The class named PlotALot01 is used to plot single-channel data. The classes named PlotALot02 and PlotALot03 are used to plot two-channel data in two different formats. The class named PlotALot04 is used to plot three-channel data.
A free plotting class
If you arrived at this page seeking a free Java class for plotting your data, you are in luck. Just copy the source code for the classes in Listing 35 through Listing 38 near the end of this module and feel free to use them as described in the comments in the source code.
On the other hand, if you would like to learn how the classes do what they do, and perhaps use your programming skills to improve them, keep reading.Hopefully, once you have finished the module, you will have learned quite a lot about plotting large quantities of data using Java.
Viewing tip
I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the Figuresand Listings while you are reading about them.
Figures
- Figure 1 . Sample output for PlotALot01 class.
- Figure 2 . Sample output for PlotALot02 class.
- Figure 3 . Sample output for PlotALot03 class.
- Figure 4 . Sample output for PlotALot04 class.
- Figure 5 . Self-test output for PlotALot01.
Listings
- Listing 1 . Beginning of the class named PlotALot01.
- Listing 2 . Feed the plotting object titled "A".
- Listing 3 . Plot the data.
- Listing 4 . Feed and plot the object titled "B".
- Listing 5 . Some instance variables.
- Listing 6 . The first overloaded constructor.
- Listing 7 . Save the parameter values.
- Listing 8 . A temporary Page object.
- Listing 9 . Display some information.
- Listing 10 . Dispose of the temporary Page object.
- Listing 11 . Compute and display the remaining plotting parameters.
- Listing 12 . Instantiate first usable Page object.
- Listing 13 . The other overloaded constructor.
- Listing 14 . The feedData method.
- Listing 15 . Beginning of the plotData method.
- Listing 16 . Make all pages invisible.
- Listing 17 . Make the pages visible in reverse order.
- Listing 18 . The other overloaded version of the plotData method.
- Listing 19 . Beginning of the class named Page.
- Listing 20 . An anonymous terminator for the Page class.
- Listing 21 . The putData method of the Page class.
- Listing 22 . Beginning of the MyCanvas class.
- Listing 23 . Beginning of the overridden paint method.
- Listing 24 . Beginning of code to plot the points.
- Listing 25 . Draw an oval.
- Listing 26 . Connect the points with straight lines.
- Listing 27 . The class named PlotALot02 and the main method.
- Listing 28 . The feedData method.
- Listing 29 . The putData method.
- Listing 30 . Beginning of the MyCanvas class.
- Listing 31 . Beginning of the overridden paint method.
- Listing 32 . New code in the overridden paint method.
- Listing 33 . Modified constructor code.
- Listing 34 . The overridden paint method.
- Listing 35 . PlotALot01.java.
- Listing 36 . PlotALot02.java.
- Listing 37 . PlotALot03.java.
- Listing 38 . PlotALot04.java.