edu.ull.cgunay.plots
Class SimplePlot

java.lang.Object
  |
  +--edu.ull.cgunay.plots.Plot
        |
        +--edu.ull.cgunay.plots.SimplePlot
All Implemented Interfaces:
HasAxisLabels, Serializable

public abstract class SimplePlot
extends Plot

A simple single axis, single data plot. An t variable is predefined in the dataset (data) corresponding to the x-axis, so that body() method can return an expression based on t. A preamble() method is provided for any other definitions.

In general the plot is assumed to be a String composed of a preamble, a plot command and some post commands or data. The preamble() method represents the information required before the actual plot command, and the body() method represents the part that will appear as the body of the plot command. The range of the plot that will appear as part of the plot command is kept as the range attribute.

As a simple example here is how to plot the y = t + 5 graph:

 class MyPlot extends SimplePlot {
   MyPlot(Range range) { super("My plot!", range); }
   String body() {
     return add("t","5");
   }
 }
 

Created: Wed Nov 6 22:37:04 2002

Modified: $Date: 2002/12/17 00:58:57 $

Version:
$Revision: 1.2 $ for this file.
Author:
Cengiz Gunay
See Also:
preamble(), body(), Serialized Form

Field Summary
(package private)  Grapher.Axis axis
          The single axis of this plot.
(package private)  Grapher.Data data
          The single axis data of this plot
 
Fields inherited from class edu.ull.cgunay.plots.Plot
axes, fontSize, grapher, label, range, title, xLabel, yLabel
 
Constructor Summary
SimplePlot(String label, Range range)
           
 
Method Summary
abstract  String body()
          Returns body that appears inside the plot command for the specific plot.
 String body(Grapher grapher)
          Helper function to set grapher before calling body.
 String preamble()
          Returns a preamble to appear before the plot command.
 String preamble(Grapher grapher)
          Returns a preamble to appear before the plot command.
 void prepare(Grapher grapher)
          Prepare the axis and data variables with given grapher.
 String recipe(Grapher grapher)
          A new way to describe plots in terms of Grapher capabilities.
 
Methods inherited from class edu.ull.cgunay.plots.Plot
add, assign, def_func, div, exp, func, geq, getFontSize, getGrapher, getLabel, getMaxRange, getMaxRange, getRange, getTitle, getXLabel, getYLabel, mul, neg, plot, profile, range, setFontSize, setGrapher, setLabel, setRange, setTitle, setXLabel, setYLabel, sub, toString, variable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

data

Grapher.Data data
The single axis data of this plot


axis

Grapher.Axis axis
The single axis of this plot.

Constructor Detail

SimplePlot

public SimplePlot(String label,
                  Range range)
Method Detail

body

public abstract String body()
Returns body that appears inside the plot command for the specific plot.

Returns:
a String value

body

public String body(Grapher grapher)
Helper function to set grapher before calling body.

Parameters:
grapher - a Grapher value
Returns:
a String value

preamble

public String preamble()
Returns a preamble to appear before the plot command. By default returns empty string.

Returns:
a String value

preamble

public String preamble(Grapher grapher)
Returns a preamble to appear before the plot command. By default returns empty string.

Returns:
a String value

prepare

public void prepare(Grapher grapher)
Prepare the axis and data variables with given grapher.

Parameters:
grapher - a Grapher value
Returns:
a String value

recipe

public String recipe(Grapher grapher)
A new way to describe plots in terms of Grapher capabilities.

Specified by:
recipe in class Plot
Parameters:
grapher - a Grapher value
Returns:
a String value