<< Chapter < Page | Chapter >> Page > |
Each x-axis has a label at the left end and the right end. Similarly, each y-axis has a label at the bottom and the top. These labels represent the valuesat the extreme ends of the axes. For example in Figure 2 , the label 800 appears at the right end of each x-axis. This is value of the x-axis where the axisintersects the border of the frame.
When adjusting the plotting parameters, keep in mind that the total width of each of the plotting areas is slightly less than 400 pixels.
(You can easily increase this to full screen width by changing one value in the Graph01 program and recompiling the program. However, I had to keep it narrow in order to publish the imagesin this publication format.)
While you can theoretically make the horizontal expanse of the x-axes as wide as you wish, because of the pixel limitation, you cannot see details thatrequire a resolution greater than the number of pixels along the x-axis. (This might be a good reason for you to modifythe Graph01 program as described above).
Regardless of the simplicity or complexity of your data-generator program, there are only two requirements for your program to operate successfully with theplotting program named Graph01 :
All that is required to implement the interface is to define a class that provides a concrete definition for each of the six methods declared in Listing 1 .
Listing 1. Source code for GraphIntfc01.java. |
---|
public interface GraphIntfc01{
public int getNmbr();public double f1(double x);
public double f2(double x);public double f3(double x);
public double f4(double x);public double f5(double x);
}//end GraphIntfc01 |
On several occasions in this module, I have stated that the plotting program can plot up to five functions. However, it doesn't have to plot allfive functions. The plotting program can be used (without modification) to plot any number of functions from one to five.
The method named getNmbr , that you must define in your data-generator program, must return an integer value between 1 and 5 that specifies the number of functions to be plotted. Theplotting program uses that value to divide the total plotting surface into the specified number of plotting areas, and plots each of the functions named f1 through fn in one of those plotting areas.
Notification Switch
Would you like to follow the 'Digital signal processing - dsp' conversation and receive update notifications?