Class JXGraph.Plot
- java.lang.Object
-
- org.jdesktop.beans.AbstractBean
-
- org.jdesktop.swingx.JXGraph.Plot
-
- Enclosing class:
- JXGraph
public abstract static class JXGraph.Plot extends AbstractBean
A plot represents a mathematical transformation used by
JXGraph
. When a plot belongs to a graph, the graph component asks for the transformation of a value along the X axis. The resulting value defines the Y coordinates at which the graph must draw a spot of color.Here is a sample implemention of this class that draws a straight line once added to a graph (it follows the well-known equation y=a.x+b):
class LinePlot extends JXGraph.Plot { public double compute(double value) { return 2.0 * value + 1.0; } }
When a plot is added to an instance of
JXGraph
, theJXGraph
automatically becomes a new property change listener of the plot. If property change events are fired, the graph will be updated accordingly.More information about plots usage can be found in
JXGraph
in the section entitled Plots.- See Also:
JXGraph
,JXGraph.addPlots(Color, JXGraph.Plot...)
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Plot()
Creates a new, parameter-less plot.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract double
compute(double value)
This method must return the result of a mathematical transformation of its sole parameter.-
Methods inherited from class org.jdesktop.beans.AbstractBean
addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clone, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, fireVetoableChange, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, hasPropertyChangeListeners, hasVetoableChangeListeners, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener
-
-
-
-
Method Detail
-
compute
public abstract double compute(double value)
This method must return the result of a mathematical transformation of its sole parameter.
- Parameters:
value
- a value along the X axis of the graph currently drawing this plot- Returns:
- the result of the mathematical transformation of value
-
-