|
swingx Version 2005-08-19 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.JXGraph.Plot
public abstract static class JXGraph.Plot
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; } }
More information about plots usage can be found in JXGraph
in
the section entitled Plots.
JXGraph
,
JXGraph.addPlots(Color, JXGraph.Plot...)
Field Summary | |
---|---|
protected PropertyChangeSupport |
support
List of property change listeners listening to this plot's instance. |
Constructor Summary | |
---|---|
protected |
JXGraph.Plot()
Creates a new, parameter-less plot. |
Method Summary | |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Registers a new property change listener with the current plot. |
abstract double |
compute(double value)
This method must return the result of a mathematical transformation of its sole parameter. |
protected void |
firePropertyChange(String propertyName,
double oldValue,
double newValue)
Notifies property change listeners that a property has changed. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a new property change listener from the current plot. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PropertyChangeSupport support
List of property change listeners listening to this plot's
instance. When this plot is added to an instance of
JXGraph
, the JXGraph
automatically becomes
a new property change listener of this plot.
Constructor Detail |
---|
protected JXGraph.Plot()
Creates a new, parameter-less plot.
Method Detail |
---|
public abstract double compute(double value)
This method must return the result of a mathematical transformation of its sole parameter.
value
- a value along the X axis of the graph currently
drawing this plot
public void addPropertyChangeListener(PropertyChangeListener listener)
Registers a new property change listener with the current plot.
listener
- the new property change listener to be notified of
property changespublic void removePropertyChangeListener(PropertyChangeListener listener)
Removes a new property change listener from the current plot.
listener
- the property change listener to be removedprotected void firePropertyChange(String propertyName, double oldValue, double newValue)
Notifies property change listeners that a property has changed. This method must be used to notify the graph that a parameter of the mathematical transformation of this plot has changed. Failing to do so, a plot will be refreshed when its internal parameters change.
propertyName
- the name of the property known to have changedoldValue
- the value of the property prior to the changenewValue
- the value of the property after the change
|
swingx Version 2005-08-19 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |