public class Canvas
extends java.lang.Object
Constructor and Description |
---|
Canvas(double[] lowerBound,
double[] upperBound)
Constructor
|
Canvas(double[] lowerBound,
double[] upperBound,
boolean extendBound)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(Plot p)
Add a graphical shape to the canvas.
|
void |
add(Shape p)
Add a graphical shape to the canvas.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list.
|
void |
clear()
Remove all graphic plots from the canvas.
|
void |
extendBound(double[] lowerBound,
double[] upperBound)
Extend lower and upper bounds.
|
void |
extendLowerBound(double[] bound)
Extend lower bounds.
|
void |
extendUpperBound(double[] bound)
Extend upper bounds.
|
Axis |
getAxis(int i)
Returns the i-th axis.
|
java.lang.String |
getAxisLabel(int i)
Returns the label/legend of an axis.
|
java.lang.String[] |
getAxisLabels()
Returns the labels/legends of axes.
|
double[] |
getLowerBounds()
Returns the lower bounds.
|
double |
getMargin()
Returns the size of margin, which is not used as plot area.
|
java.beans.PropertyChangeListener[] |
getPropertyChangeListeners()
Returns an array of all the listeners that were added to
the PropertyChangeSupport object with addPropertyChangeListener().
|
java.util.List<Shape> |
getShapes()
Returns the list of shapes in the canvas.
|
java.lang.String |
getTitle()
Returns the main title of canvas.
|
java.awt.Color |
getTitleColor()
Returns the color for title.
|
java.awt.Font |
getTitleFont()
Returns the font for title.
|
double[] |
getUpperBounds()
Returns the upper bounds.
|
boolean |
isLegendVisible()
Returns true if legends are visible.
|
void |
paint(java.awt.Graphics2D g2d,
int width,
int height)
Paints the canvas.
|
PlotPanel |
panel()
Returns a Swing JPanel of the canvas.
|
void |
remove(Plot p)
Remove a graphical shape from the canvas.
|
void |
remove(Shape p)
Remove a graphical shape from the canvas.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list.
|
Canvas |
setAxisLabel(int i,
java.lang.String label)
Sets the label/legend of an axis.
|
Canvas |
setAxisLabels(java.lang.String... labels)
Sets the labels/legends of axes.
|
void |
setBound(double[] lowerBound,
double[] upperBound)
Extend lower and upper bounds.
|
Canvas |
setLegendVisible(boolean visible)
Sets if legends are visible.
|
Canvas |
setMargin(double margin)
Sets the size of margin in [0.0, 0.3] on each side.
|
Canvas |
setTitle(java.lang.String title)
Set the main title of canvas.
|
Canvas |
setTitleColor(java.awt.Color color)
Set the color for title.
|
Canvas |
setTitleFont(java.awt.Font font)
Set the font for title.
|
java.awt.image.BufferedImage |
toBufferedImage(int width,
int height)
Exports the plot to an image.
|
javax.swing.JFrame |
window()
Shows the plot in a window.
|
public Canvas(double[] lowerBound, double[] upperBound)
public Canvas(double[] lowerBound, double[] upperBound, boolean extendBound)
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public java.beans.PropertyChangeListener[] getPropertyChangeListeners()
public java.awt.image.BufferedImage toBufferedImage(int width, int height)
width
- the width of image.height
- the height of image.public boolean isLegendVisible()
public Canvas setLegendVisible(boolean visible)
public double getMargin()
public Canvas setMargin(double margin)
margin
- the size of margin.public java.lang.String getTitle()
public Canvas setTitle(java.lang.String title)
public java.awt.Font getTitleFont()
public Canvas setTitleFont(java.awt.Font font)
public java.awt.Color getTitleColor()
public Canvas setTitleColor(java.awt.Color color)
public Axis getAxis(int i)
public java.lang.String[] getAxisLabels()
public java.lang.String getAxisLabel(int i)
public Canvas setAxisLabels(java.lang.String... labels)
public Canvas setAxisLabel(int i, java.lang.String label)
public java.util.List<Shape> getShapes()
public void add(Shape p)
public void remove(Shape p)
public void add(Plot p)
public void remove(Plot p)
public void clear()
public double[] getLowerBounds()
public double[] getUpperBounds()
public void extendLowerBound(double[] bound)
public void extendUpperBound(double[] bound)
public void extendBound(double[] lowerBound, double[] upperBound)
public void setBound(double[] lowerBound, double[] upperBound)
public void paint(java.awt.Graphics2D g2d, int width, int height)
public PlotPanel panel()
public javax.swing.JFrame window() throws java.lang.InterruptedException, java.lang.reflect.InvocationTargetException
java.lang.InterruptedException
java.lang.reflect.InvocationTargetException