public class Graph2D extends Canvas
Component.BaselineResizeBehavior
Modifier and Type | Field and Description |
---|---|
int |
borderBottom
The width of the border at the bottom of the canvas.
|
int |
borderLeft
The width of the border at the left of the canvas.
|
int |
borderRight
The width of the border at the right of the canvas.
|
int |
borderTop
The width of the border at the top of the canvas.
|
boolean |
clearAll
If set true (the default) the canvas will be set to the background
color (erasing the plot) when the update method is called.
|
Rectangle |
datarect
The rectangle that the data will be plotted within.
|
boolean |
drawgrid
If set true (the default) a grid will be drawn over the data window.
|
boolean |
drawzero
If set true (the default) a grid line will be drawn
across the data window
at the zeros of the innermost axes.
|
boolean |
frame
If set true a frame will be drawn around the data window.
|
Color |
framecolor
The color of the frame to be drawn
|
Color |
gridcolor
The color of the grid to be drawn
|
TextLine |
lastText
Text to be painted Last onto the Graph Canvas.
|
int |
loadingData
If this is greater than zero it means that
data loading threads are active so the message "loading data"
is flashed on the plot canvas.
|
boolean |
paintAll
If set true (the default) everything associated with the plot
will be drawn when the update method or paint method are called.
|
boolean |
square
Modify the position of the axis and the range of the axis so that
the aspect ratio of the major tick marks are 1 and the plot is square
on the screen
|
Color |
zerocolor
The color of the zero grid lines.
|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Graph2D() |
Modifier and Type | Method and Description |
---|---|
void |
attachAxis(Axis a)
Attach a previously created Axis.
|
void |
attachDataSet(DataSet d)
Attach a DataSet to the graph.
|
Axis |
createAxis(int position)
Create and attach an Axis to the graph.
|
void |
detachAxes()
Detach All attached Axes.
|
void |
detachAxis(Axis a)
Detach a previously attached Axis.
|
void |
detachDataSet(DataSet d)
Detach the DataSet from the class.
|
void |
detachDataSets()
Detach All the DataSets from the class.
|
void |
finishedloading()
Decrement the loading Data counter by one.
|
Markers |
getMarkers()
Get the markers
|
double |
getXmax()
Get the Maximum X value of all attached DataSets.
|
double |
getXmin()
Get the Minimum X value of all attached DataSets.
|
double |
getYmax()
Get the Maximum Y value of all attached DataSets.
|
double |
getYmin()
Get the Minimum Y value of all attached DataSets.
|
boolean |
keyDown(Event e,
int key)
Handle keyDown events.
|
DataSet |
loadDataSet(double[] data,
int n)
Load and Attach a DataSet from an array.
|
DataSet |
loadFile(URL file)
Load and Attach a DataSet from a File.
|
void |
loadmessage(String s)
Change the message to be flashed on the canvas
|
void |
paint(Graphics g)
This paints the entire plot.
|
void |
paintBeforeData(Graphics g,
Rectangle r)
A hook into the Graph2D.paint method.
|
void |
paintFirst(Graphics g,
Rectangle r)
A hook into the Graph2D.paint method.
|
void |
paintLast(Graphics g,
Rectangle r)
A hook into the Graph2D.paint method.
|
void |
setDataBackground(Color c)
Set the background color for the data window.
|
void |
setGraphBackground(Color c)
Set the background color for the entire canvas.
|
void |
setMarkers(Markers m)
Set the markers for the plot.
|
void |
startedloading()
Calling this method pauses the plot and displays a flashing
message on the screen.
|
void |
update(Graphics g)
This method is called via the Graph2D.repaint() method.
|
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
public int loadingData
public int borderTop
public int borderBottom
public int borderLeft
public int borderRight
public boolean frame
public Color framecolor
public boolean drawgrid
public Color gridcolor
public boolean drawzero
public Color zerocolor
public Rectangle datarect
public boolean clearAll
public boolean paintAll
public boolean square
public TextLine lastText
public DataSet loadFile(URL file)
file
- The URL of the data file to read.public DataSet loadDataSet(double[] data, int n)
data
- The data to be loaded in the form x,y,x,y,...n
- The number of (x,y) data points. This means that the
minimum length of the data array is 2*n.public void attachDataSet(DataSet d)
public void detachDataSet(DataSet d)
d
- The DataSet to detach.public void detachDataSets()
public Axis createAxis(int position)
position
- Position of the axis in the drawing window.public void attachAxis(Axis a)
the
- Axis to attach.public void detachAxis(Axis a)
the
- Axis to dettach.public void detachAxes()
public double getXmax()
public double getYmax()
public double getXmin()
public double getYmin()
public void setMarkers(Markers m)
m
- Marker class containing the defined markersMarkers
public Markers getMarkers()
Markers
public void setGraphBackground(Color c)
public void setDataBackground(Color c)
public void paint(Graphics g)
public void paintFirst(Graphics g, Rectangle r)
public void paintBeforeData(Graphics g, Rectangle r)
public void paintLast(Graphics g, Rectangle r)
public void update(Graphics g)
public boolean keyDown(Event e, int key)
public void startedloading()
finishedloading()
,
Graph2D#loadmessage()
,
LoadMessage
public void finishedloading()
startedloading()
,
Graph2D#loadmessage()
,
LoadMessage
public void loadmessage(String s)
s
- String contining the new message.startedloading()
,
finishedloading()
,
LoadMessage
Jas4pp 1.5 © Java Analysis Studio for Particle Physics