|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel info.monitorenter.gui.chart.Chart2D
public class Chart2D
Chart2D
is a component for displaying the data contained in a
ITrace2D
. It inherits many features from
javax.swing.JPanel
and allows specific configuration.
In order to simplify the use of it, the scaling, labeling and choosing of
display- range is done automatically which flattens the free configuration.
There are several default settings that may be changed in
Chart2D
TracePoint2D
contained in the all ITrace2d
instances connected. This is because the
IAxis
of the chart (for x and y) use by
default a
RangePolicyUnbounded
. To
change this, get the axis of the chart to change (via getAxisX()
,
getAxisY()
) and invoke
IAxis.setRangePolicy(IRangePolicy)
with
the desired view port behavior.
paint()
operation every TracePoint2D
is taken from the ITrace2D
- instance exactly in the order, it's
iterator returns them. From every TracePoint2D
then a line is
drawn to the next. ITrace2D
to avoid this. To change this line painting behavior
you can use custom renderers at the level of traces via
ITrace2D.addTracePainter(ITracePainter)
or
ITrace2D.setTracePainter(ITracePainter)
.
IAxis.setPaintScale(boolean)
This allows saving of many
computations.
... Chart2D test = new Chart2D(); JFrame frame = new JFrame("Chart2D- Debug"); frame.setSize(400,200); frame.setVisible(true); ITrace2D atrace = new Trace2DLtd(100); ... <further configuration of trace> ... test.addTrace(atrace); .... while(expression){ atrace.addPoint(adouble,bdouble); .... }
PropertyChangeListener
instances may be added via
Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
. They inherit the properties to listen from
Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
. Additionally more PropertyChangeEvents
are triggered.
As the set of traces inside this class is a collection (and no single
property) the PropertyChangeEvent
fired for a change of
properties property will contain a reference to the Chart2D
instance as well as the ITrace2D
(if involved in the change).
getPropertyName() |
getSource() |
getOldValue() |
getNewValue() |
occurrence |
---|---|---|---|---|
PROPERTY_BACKGROUND_COLOR |
Chart2D |
Color |
Color |
if a change of the background color occurs. |
PROPERTY_AXIS_X |
Chart2D |
null | IAxis |
if a new axis is added in x dimension (addAxisXBottom(AAxis) , @link
addAxisXTop(AAxis) ). |
PROPERTY_AXIS_X |
Chart2D |
IAxis |
null | if an axis is removed in x dimension (removeAxisXBottom(IAxis) ,
removeAxisXTop(IAxis) ). |
PROPERTY_AXIS_Y |
Chart2D |
null | IAxis |
if a new axis is added in y dimension (addAxisYLeft(AAxis) ,
addAxisYRight(AAxis) ). |
PROPERTY_AXIS_X_BOTTOM_REPLACE |
Chart2D |
IAxis |
IAxis |
if a axis is replaced in bottom x dimension (
setAxisXBottom(AAxis, int) ). |
PROPERTY_AXIS_X_TOP_REPLACE |
Chart2D |
IAxis |
IAxis |
if a axis is replaced in top x dimension (
setAxisXTop(AAxis, int) ). |
PROPERTY_AXIS_Y_LEFT_REPLACE |
Chart2D |
IAxis |
IAxis |
if a axis is replaced in left y dimension (
setAxisYLeft(AAxis, int) ). |
PROPERTY_AXIS_Y_RIGHT_REPLACE |
Chart2D |
IAxis |
IAxis |
if a axis is replaced in right y dimension (
setAxisYRight(AAxis, int) ). |
PROPERTY_GRID_COLOR |
Chart2D |
Color |
Color |
if a change of the grid color occurs. |
PROPERTY_ADD_REMOVE_TRACE |
Chart2D |
ITrace2D |
ITrace2D |
If a change of the traces occurs. If the old value is null a new trace has been added. If the new value is null, oldvalue trace has been removed. If both are null this is a bug. |
PROPERTY_PAINTLABELS |
Chart2D |
Boolean |
Boolean |
if a change of the paint labels flag occurs. |
PROPERTY_TOOLTIP_TYPE |
Chart2D |
IToolTipType |
IToolTipType |
if a change of the tool tip type occurs. |
PROPERTY_POINT_HIGHLIGHTING_ENABLED |
Chart2D |
Boolean |
Boolean |
if point highlighting is enabled/disabled. |
ITrace2D.PROPERTY_POINT_HIGHLIGHTERS_CHANGED |
Chart2D |
IPointPainter |
null | if a point highlighter was added to any of the currently contained traces. |
ITrace2D.PROPERTY_POINT_HIGHLIGHTERS_CHANGED |
Chart2D |
null | IPointPainter |
if a point highlighter was removed from any of the currently contained traces. |
PROPERTY_ANTIALIASING_ENABLED |
Chart2D |
Boolean |
Boolean |
if antialiasing is enabled/disabled. |
PROPERTY_POINTFINDER |
Chart2D |
IPointFinder |
IPointFinder |
if setPointFinder(IPointFinder) caused a change. |
Nested Class Summary | |
---|---|
static class |
Chart2D.PointFinder
Types of tool tip. |
static class |
Chart2D.ToolTipType
Types of tool tip. |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
static java.lang.String[] |
AXIX_CONSTANT_NAMES
Speaking names for axis constants - used for debugging only. |
static int |
CHART_POSITION_BOTTOM
Constant describing the bottom side of the chart. |
static int |
CHART_POSITION_LEFT
Constant describing the left side of the chart. |
static int |
CHART_POSITION_RIGHT
Constant describing the right side of the chart. |
static int |
CHART_POSITION_TOP
Constant describing the top side of the chart. |
static boolean |
DEBUG_HIGHLIGHTING
A package wide switch for debugging problems with highlighting. |
static boolean |
DEBUG_SCALING
A package wide switch for debugging problems with scaling. |
static boolean |
DEBUG_THREADING
A package wide switch for debugging problems with multithreading. |
protected int |
m_minPaintLatency
Chart - wide setting for the ms to give a repaint operation time for collecting several repaint requests into one (performance versus update speed). |
static java.lang.String |
PROPERTY_ADD_REMOVE_TRACE
The bean property constant identifying a change of traces. |
static java.lang.String |
PROPERTY_ANTIALIASING_ENABLED
The bean property constant identifying a change of the
antialiasing enabled state. |
static java.lang.String |
PROPERTY_AXIS_X
The bean property constant identifying a change of the
internal instance for the x dimension. |
static java.lang.String |
PROPERTY_AXIS_X_BOTTOM_REPLACE
The bean property constant identifying a replacement of an
internal instance for the bottom x dimension. |
static java.lang.String |
PROPERTY_AXIS_X_TOP_REPLACE
The bean property constant identifying a replacement of an
internal instance for the top x dimension. |
static java.lang.String |
PROPERTY_AXIS_Y
The bean property constant identifying a change of the
internal instance for the y dimension. |
static java.lang.String |
PROPERTY_AXIS_Y_LEFT_REPLACE
The bean property constant identifying a replacement of an
internal instance for the left y dimension. |
static java.lang.String |
PROPERTY_AXIS_Y_RIGHT_REPLACE
The bean property constant identifying a replacement of an
internal instance for the right y dimension. |
static java.lang.String |
PROPERTY_BACKGROUND_COLOR
The bean property constant identifying a change of the
background color. |
static java.lang.String |
PROPERTY_FONT
The bean property constant identifying a change of the font. |
static java.lang.String |
PROPERTY_FOREGROUND_COLOR
The bean property constant identifying a change of the
foreground color. |
static java.lang.String |
PROPERTY_GRID_COLOR
The bean property constant identifying a change of the grid
color. |
static java.lang.String |
PROPERTY_PAINTLABELS
The bean property constant identifying a change of the paint
labels flag. |
static java.lang.String |
PROPERTY_POINT_HIGHLIGHTING_ENABLED
The bean property constant identifying a change of the point
highlighting enabled state. |
static java.lang.String |
PROPERTY_POINTFINDER
The bean property constant identifying a change of the
internal instance used to find the
nearest point corresponding to mouse events over the chart. |
static java.lang.String |
PROPERTY_TOOLTIP_TYPE
The bean property constant identifying a change of the tool
tip type ({Chart2D ). |
static int |
X
Constant describing the x axis (needed for scaling). |
static int |
X_Y
Constant describing the x and y axis (needed for scaling). |
static int |
Y
Constant describing the y axis (needed for scaling). |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Chart2D()
Creates a new chart. |
Method Summary | |
---|---|
void |
addAxisXBottom(AAxis<?> axisX)
Adds the given x axis to the list of internal bottom x axes. |
void |
addAxisXTop(AAxis<?> axisX)
Adds the given x axis to the list of internal top x axes. |
void |
addAxisYLeft(AAxis<?> axisY)
Adds the given y axis to the list of internal left y axes. |
void |
addAxisYRight(AAxis<?> axisY)
Adds the given y axis to the list of internal right y axes. |
void |
addTrace(ITrace2D points)
Convenience method that adds the trace to this chart with relation to the first bottom x axis and the first left y axis. |
void |
addTrace(ITrace2D points,
IAxis<?> xAxis,
IAxis<?> yAxis)
Adds the trace to this chart with relation to the given x axis and y axis. |
javax.swing.JToolTip |
createToolTip()
|
void |
destroy()
Destroys the chart. |
boolean |
enablePointHighlighting(boolean onoff)
Switches point highlighting on or off depending on the given argument. |
protected void |
finalize()
Cleanup when this instance is dropped. |
IAxis<?>[] |
findAxesOfTrace(ITrace2D trace)
Returns an array with the x (position 0) and the y axis (position 1) of the given trace if it is correctly set up. |
java.util.List<IAxis<?>> |
getAxes()
Returns the with all axes of the chart. |
java.util.List<IAxis<?>> |
getAxesXBottom()
Returns the with instances that are
painted in x dimension on the bottom of the chart. |
java.util.List<IAxis<?>> |
getAxesXTop()
Returns the with instances that are
painted in x dimension on top of the chart. |
java.util.List<IAxis<?>> |
getAxesYLeft()
Returns the with instances that are
painted in y dimension on the left side of the chart. |
java.util.List<IAxis<?>> |
getAxesYRight()
Returns the with instances that are
painted in y dimension on the right side of the chart. |
IAxisTickPainter |
getAxisTickPainter()
Returns the painter for the ticks of the axis. |
IAxis<?> |
getAxisX()
Returns the first bottom axis for the x dimension. |
IAxis<?> |
getAxisX(ITrace2D trace)
Returns the x axis that the given trace belongs to or null if this trace does not belong to any x axis of this chart. |
IAxis<?> |
getAxisY()
Returns the first left axis for the y dimension. |
IAxis<?> |
getAxisY(ITrace2D trace)
Returns the y axis that the given trace belongs to or null if this trace does not belong to any y axis of this chart. |
java.awt.Color |
getGridColor()
Returns the color of the grid. |
int |
getHeight()
|
int |
getMinPaintLatency()
Returns the chart - wide setting for the ms to give a repaint operation time for collecting several repaint requests into one (performance vs. |
ITracePoint2D |
getNearestPointEuclid(int mouseEventX,
int mouseEventY)
Returns the nearest to the given mouse
event's screen coordinates in Euclid distance. |
ITracePoint2D |
getNearestPointEuclid(java.awt.event.MouseEvent me)
Returns the nearest to the given mouse
event's screen coordinates in Euclid distance. |
ITracePoint2D |
getNearestPointManhattan(int mouseEventX,
int mouseEventY)
Returns the nearest to the given mouse
event's screen coordinates in Manhattan distance. |
ITracePoint2D |
getNearestPointManhattan(java.awt.event.MouseEvent me)
Returns the nearest to the given mouse
event's screen coordinates in Manhattan distance. |
IPointFinder |
getPointFinder()
Returns the point finder used to find the nearest point corresponding to a mouse event. |
java.awt.Dimension |
getPreferredSize()
|
java.awt.Dimension |
getSize()
Overridden to allow full - page printing. |
Chart2D |
getSynchronizedXStartChart()
Returns the chart that will be synchronized for finding the start coordinate of this chart to draw in x dimension (
). |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent event)
|
IToolTipType |
getToolTipType()
Returns the type of tool tip shown. |
ITracePointProvider |
getTracePointProvider()
Returns the trace point creator of this chart. |
java.util.SortedSet<ITrace2D> |
getTraces()
Returns the set of traces that are currently rendered by this instance. |
int |
getWidth()
|
int |
getXAxisWidth()
Returns the width of the X axis in px. |
int |
getXChartEnd()
Returns the x coordinate of the chart's right edge in px. |
int |
getXChartStart()
Returns the x coordinate of the chart's left edge in px. |
int |
getYChartEnd()
Returns the y coordinate of the upper edge of the chart's display area in px. |
int |
getYChartStart()
Returns the y coordinate of the chart's lower edge in px. |
boolean |
isEnabledPointHighlighting()
Returns true if highlighting of the nearest point to the cursor is enabled. |
boolean |
isPaintLabels()
Returns true if labels for each chart are painted below it, false else. |
protected boolean |
isRequestedRepaint()
Returns the requestedRepaint. |
boolean |
isToolTipCoords()
Returns true if chart coordinates are drawn as tool tips. |
boolean |
isUseAntialiasing()
Returns whether antialiasing is used. |
boolean |
isVisible(ITracePoint2D point)
Returns true if the given point is in the visible drawing area of the Chart2D. |
java.util.Iterator<ITrace2D> |
iterator()
Returns an Iterator over the contained ITrace2D
instances. |
void |
paint(java.awt.Graphics g)
This method is just overridden to ensure a lock on this instance and then a lock on just as it has to be done in that order in
. |
protected void |
paintComponent(java.awt.Graphics g)
A basic rule of a JComponent is: Never invoke this method directly. |
int |
print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
|
void |
propertyChange(java.beans.PropertyChangeEvent evt)
Receives all from all instances
the chart registers itself as a
. |
java.util.Set<ITrace2D> |
removeAllTraces()
Convenience method to remove all traces from this chart. |
boolean |
removeAxisXBottom(IAxis<?> axisX)
Removes the given x axis from the list of internal bottom x axes. |
boolean |
removeAxisXTop(IAxis<?> axisX)
Removes the given x axis from the list of internal top x axes. |
boolean |
removeAxisYLeft(IAxis<?> axisY)
Removes the given y axis from the list of internal left y axes. |
boolean |
removeAxisYRight(IAxis<?> axisY)
Removes the given y axis from the list of internal right y axes. |
boolean |
removeTrace(ITrace2D points)
Removes the given instance from this Chart2D if it is
contained. |
void |
repaint()
Deprecated. use setRequestedRepaint(boolean) . |
void |
repaint(int x,
int y,
int width,
int height)
Deprecated. use setRequestedRepaint(boolean) . |
void |
repaint(long tm)
Deprecated. use setRequestedRepaint(boolean) . |
void |
repaint(long tm,
int x,
int y,
int width,
int height)
Deprecated. use setRequestedRepaint(boolean) . |
void |
repaint(java.awt.Rectangle r)
Deprecated. use setRequestedRepaint(boolean) . |
void |
resetPrintMode()
Only intended for . |
void |
setAxisTickPainter(IAxisTickPainter tickPainter)
Sets the axis tick painter. |
java.util.List<IAxis<?>> |
setAxisX(AAxis<?> axisX)
Deprecated. use instead. |
IAxis<?> |
setAxisXBottom(AAxis<?> axisX,
int position)
Sets the bottom x axis on the given position to use and replaces the old one on that place. |
IAxis<?> |
setAxisXTop(AAxis<?> axisX,
int position)
Sets the top x axis on the given position to use and replaces the old one on that place. |
java.util.List<IAxis<?>> |
setAxisY(AAxis<?> axisY)
Deprecated. use instead. |
IAxis<?> |
setAxisYLeft(AAxis<?> axisY,
int position)
Sets the left y axis on the given position to use and replaces the old one on that place. |
IAxis<?> |
setAxisYRight(AAxis<?> axisY,
int position)
Sets the right y axis on the given position to use and replaces the old one on that place. |
void |
setGridColor(java.awt.Color gridclr)
Set the grid color to use. |
void |
setMinPaintLatency(int minPaintLatency)
Sets the ms to give a repaint operation time for collecting several repaint requests into one (performance vs. |
void |
setPaintLabels(boolean paintLabels)
Decide whether labels for each chart are painted below it. |
void |
setPointFinder(IPointFinder pointFinder)
Sets the point finder used to find the nearest point corresponding to a mouse event. |
void |
setRequestedRepaint(boolean requestedRepaint)
Sets the requestedRepaint. |
void |
setSynchronizedXStartChart(Chart2D synchronizedXStartChart)
Sets the chart that will be synchronized for finding the start coordinate of this chart to draw in x dimension ( ). |
void |
setToolTipCoords(boolean toolTipCoords)
Deprecated. use with
instead. |
void |
setToolTipType(IToolTipType toolTipType)
Sets the type of tool tip to use. |
void |
setTracePointProvider(ITracePointProvider tracePointProvider)
Sets the trace point creator of this chart. |
void |
setUseAntialiasing(boolean useAntialiasing)
Sets whether antialiasing is used. |
java.awt.image.BufferedImage |
snapShot()
Returns a BufferedImage with the current width and height of the chart filled with the Chart2D's graphics that may be written to a file or OutputStream by using: ImageIO.write(java.awt.image.RenderedImage, java.lang.String, java.io.File)
. |
java.awt.image.BufferedImage |
snapShot(int width,
int height)
Returns a BufferedImage with the given width and height that is filled with tChart2D's graphics that may be written to a file or OutputStream by using: ImageIO.write(java.awt.image.RenderedImage, java.lang.String, java.io.File)
. |
java.lang.String |
toString()
|
ITracePoint2D |
translateMousePosition(java.awt.event.MouseEvent mouseEvent)
Deprecated. this method is a candidate for wrong behavior when using multiple axes. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] AXIX_CONSTANT_NAMES
public static final int CHART_POSITION_BOTTOM
IAxis.getAxisPosition()
,
Constant Field Valuespublic static final int CHART_POSITION_LEFT
IAxis.getAxisPosition()
,
Constant Field Valuespublic static final int CHART_POSITION_RIGHT
IAxis.getAxisPosition()
,
Constant Field Valuespublic static final int CHART_POSITION_TOP
IAxis.getAxisPosition()
,
Constant Field Valuespublic static final boolean DEBUG_SCALING
public static final boolean DEBUG_HIGHLIGHTING
public static final boolean DEBUG_THREADING
public static final java.lang.String PROPERTY_ANTIALIASING_ENABLED
constant
identifying a change of the
antialiasing enabled state.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
public static final java.lang.String PROPERTY_AXIS_X
constant
identifying a change of the
internal IAxis
instance for the x dimension.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
See the class description for property change events fired.
public static final java.lang.String PROPERTY_AXIS_X_BOTTOM_REPLACE
constant
identifying a replacement of an
internal IAxis
instance for the bottom x dimension.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
See the class description for property change events fired.
public static final java.lang.String PROPERTY_AXIS_X_TOP_REPLACE
constant
identifying a replacement of an
internal IAxis
instance for the top x dimension.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
See the class description for property change events fired.
public static final java.lang.String PROPERTY_AXIS_Y
constant
identifying a change of the
internal IAxis
instance for the y dimension.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
See the class description for property change events fired.
public static final java.lang.String PROPERTY_AXIS_Y_LEFT_REPLACE
constant
identifying a replacement of an
internal IAxis
instance for the left y dimension.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
See the class description for property change events fired.
public static final java.lang.String PROPERTY_AXIS_Y_RIGHT_REPLACE
constant
identifying a replacement of an
internal IAxis
instance for the right y dimension.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
See the class description for property change events fired.
public static final java.lang.String PROPERTY_BACKGROUND_COLOR
constant
identifying a change of the
background color. PropertyChangeListener
with the Chart2D
.
The property change events for this change are constructed and fired by the
superclass Container
so this constant is just for
clarification of the String that is related to that property.
public static final java.lang.String PROPERTY_FONT
constant
identifying a change of the font.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
The property change events for this change are constructed and fired by the
superclass Container
so this constant is just for
clarification of the String that is related to that property.
public static final java.lang.String PROPERTY_FOREGROUND_COLOR
constant
identifying a change of the
foreground color. PropertyChangeListener
with the Chart2D
.
The property change events for this change are constructed and fired by the
superclass Container
so this constant is just for
clarification of the String that is related to that property.
public static final java.lang.String PROPERTY_GRID_COLOR
constant
identifying a change of the grid
color.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
public static final java.lang.String PROPERTY_ADD_REMOVE_TRACE
constant
identifying a change of traces.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
public static final java.lang.String PROPERTY_PAINTLABELS
constant
identifying a change of the paint
labels flag.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
public static final java.lang.String PROPERTY_POINT_HIGHLIGHTING_ENABLED
constant
identifying a change of the point
highlighting enabled state.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
public static final java.lang.String PROPERTY_POINTFINDER
constant
identifying a change of the
internal IPointFinder
instance used to find the
nearest point corresponding to mouse events over the chart.
Use this constant to register a PropertyChangeListener
with the Chart2D
.
See the class description for property change events fired.
public static final java.lang.String PROPERTY_TOOLTIP_TYPE
constant
identifying a change of the tool
tip type ({Chart2DsetToolTipType(IToolTipType)
).
Use this constant to register a PropertyChangeListener
with the Chart2D
.
The property change events for this change are constructed and fired by the
superclass Container
so this constant is just for
clarification of the String that is related to that property.
public static final int X
public static final int X_Y
public static final int Y
protected int m_minPaintLatency
Constructor Detail |
---|
public Chart2D()
Method Detail |
---|
public void addAxisXBottom(AAxis<?> axisX)
The given axis must not be contained before (e.g. as right y axis or bottom x axis...).
axisX
- the additional bottom x axis.public void addAxisXTop(AAxis<?> axisX)
The given axis must not be contained before (e.g. as right y axis or bottom x axis...).
axisX
- the additional top x axis.public void addAxisYLeft(AAxis<?> axisY)
The given axis must not be contained before (e.g. as right y axis or bottom x axis...).
axisY
- the additional left y axis.public void addAxisYRight(AAxis<?> axisY)
The given axis must not be contained before (e.g. as right y axis or bottom x axis...).
axisY
- the additional right y axis.public final void addTrace(ITrace2D points)
ITrace2D.isVisible()
returns true) in this chart.
This method will trigger a PropertyChangeEvent
being
fired on all instances registered by
Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
(registered with String
argument
IAxis.PROPERTY_ADD_REMOVE_TRACE
) on the internal bottom x axis and
left y axis.
points
- the trace to add.IAxis.PROPERTY_ADD_REMOVE_TRACE
,
addTrace(ITrace2D, IAxis, IAxis)
public final void addTrace(ITrace2D points, IAxis<?> xAxis, IAxis<?> yAxis)
ITrace2D.isVisible()
returns true) in
this chart.
This method will trigger a PropertyChangeEvent
being
fired on all instances registered by
Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
(registered with String
argument
IAxis.PROPERTY_ADD_REMOVE_TRACE
) on the axis of this chart.
The given x and y axis will be responsible for computation of the scale of this trace.
points
- the trace to add.xAxis
- the x axis responsible for the scale of this trace - it has to be
contained in this chart or an exception will be thrown.yAxis
- the y axis responsible for the scale of this trace - it has to be
contained in this chart or an exception will be thrown.IAxis.PROPERTY_ADD_REMOVE_TRACE
public javax.swing.JToolTip createToolTip()
createToolTip
in class javax.swing.JComponent
JComponent.createToolTip()
public void destroy()
This method is only of interest if you have an application that dynamically adds and removes charts. So if you use the same Chart2D object(s) during the applications lifetime there is no need to use this method.
public boolean enablePointHighlighting(boolean onoff)
Turning off this removes a
and
therefore avoids receiving a lot of mouse events which will result in
potentially very expensive (many traces with many points) computations to
find the nearest point corresponding to the mouse pointer. So dropping the
point highlighting feature may result in much better real time performance.
MouseMotionListener
Keep in mind that the view part of point highlighting is configured by
configuring the point highlighters for your traces:
.
ITrace2D.addPointHighlighter(IPointPainter)
This method might trigger a PropertyChangeEvent
being
fired on all instances registered by
Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
(registered with String
argument
PROPERTY_POINT_HIGHLIGHTING_ENABLED
).
onoff
- if true the closest point to the cursor will be highlighted, if
false you might gain performance by having this feature turned
off!
ITrace2D.addPointHighlighter(IPointPainter)
,
isEnabledPointHighlighting()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- if a finalizer of a superclass fails.Object.finalize()
public IAxis<?>[] findAxesOfTrace(ITrace2D trace)
null
on the corresponding position
trace
- the trace to find the axes of.
public final java.util.List<IAxis<?>> getAxes()
List
<IAxis
>
with all axes of the chart.
List
<IAxis
>
with all axes of
the chartpublic final java.util.List<IAxis<?>> getAxesXBottom()
List
<IAxis
>
with instances that are
painted in x dimension on the bottom of the chart.
Caution! The original list is returned so modifications of it will cause unpredictable side effects.
List
<IAxis
>
with instances
that are painted in x dimension on the bottom of the chart.public final java.util.List<IAxis<?>> getAxesXTop()
List
<IAxis
>
with instances that are
painted in x dimension on top of the chart.
Caution! The original list is returned so modifications of it will cause unpredictable side effects.
List
<IAxis
>
with instances
that are painted in x dimension on top of the chart.public final java.util.List<IAxis<?>> getAxesYLeft()
List
<IAxis
>
with instances that are
painted in y dimension on the left side of the chart.
Caution! The original list is returned so modifications of it will cause unpredictable side effects.
List
<IAxis
>
with instances
that are painted in y dimension on the left side of the chart.public final java.util.List<IAxis<?>> getAxesYRight()
List
<IAxis
>
with instances that are
painted in y dimension on the right side of the chart.
Caution! The original list is returned so modifications of it will cause unpredictable side effects.
List
<IAxis
>
with instances
that are painted in y dimension on the right side of the chart.public IAxisTickPainter getAxisTickPainter()
public final IAxis<?> getAxisX()
public IAxis<?> getAxisX(ITrace2D trace)
trace
- the trace to find the corresponding x axis of this chart for.
public final IAxis<?> getAxisY()
public IAxis<?> getAxisY(ITrace2D trace)
trace
- the trace to find the corresponding y axis of this chart for.
public final java.awt.Color getGridColor()
public int getHeight()
getHeight
in class javax.swing.JComponent
JComponent.getHeight()
public int getMinPaintLatency()
public ITracePoint2D getNearestPointEuclid(int mouseEventX, int mouseEventY)
ITracePoint2D
to the given mouse
event's screen coordinates in Euclid distance.
This method is expensive and should not be used when rendering fast changing charts with many points.
Using the Manhattan distance is much faster than Euclid distance as it only includes basic addition an absolute value for computation per point (vs. square root, addition and quadrature for Euclid distance). However the euclid distance spans a circle for the nearest points which is visually more normal for end users than the Manhattan distance which forms a rhombus and reaches far distances in only one dimension.
mouseEventX
- the x pixel value relative to the chart (e.g.:
MouseEvent.getY()
).mouseEventY
- the y pixel value relative to the chart (e.g.:
MouseEvent.getY()
).
ITracePoint2D
to the given mouse
event's screen coordinates.public ITracePoint2D getNearestPointEuclid(java.awt.event.MouseEvent me)
MouseEvent
to the given mouse
event's screen coordinates in Euclid distance.
This method is expensive and should not be used when rendering fast changing charts with many points.
Note that the given mouse event should be an event fired on this chart component. Else results will point to the nearest point of the chart in the direction of the mouse event's position.
Using the Manhattan distance is much faster than Euclid distance as it only includes basic addition an absolute value for computation per point (vs. square root, addition and quadrature for Euclid distance). However the euclid distance spans a circle for the nearest points which is visually more normal for end users than the Manhattan distance which forms a rhombus and reaches far distances in only one dimension.
me
- a mouse event fired on this component.
MouseEvent
to the given mouse event's
screen coordinates or null
if the chart is empty.public ITracePoint2D getNearestPointManhattan(int mouseEventX, int mouseEventY)
ITracePoint2D
to the given mouse
event's screen coordinates in Manhattan distance.
This method is expensive and should not be used when rendering fast changing charts with many points.
Using the Manhattan distance is much faster than Euclid distance as it only includes basic addition an absolute value for computation per point (vs. square root, addition and quadrature for Euclid distance). However the euclid distance spans a circle for the nearest points which is visually more normal for end users than the Manhattan distance which forms a rhombus and reaches far distances in only one dimension.
mouseEventX
- the x pixel value relative to the chart (e.g.:
MouseEvent.getY()
).mouseEventY
- the y pixel value relative to the chart (e.g.:
MouseEvent.getY()
).
ITracePoint2D
to the given mouse
event's screen coordinates.public ITracePoint2D getNearestPointManhattan(java.awt.event.MouseEvent me)
MouseEvent
to the given mouse
event's screen coordinates in Manhattan distance.
This method is expensive and should not be used when rendering fast changing charts with many points.
Note that the given mouse event should be an event fired on this chart component. Else results will point to the nearest point of the chart in the direction of the mouse event's position.
Using the Manhattan distance is much faster than Euclid distance as it only includes basic addition an absolute value for computation per point (vs. square root, addition and quadrature for Euclid distance). However the euclid distance spans a circle for the nearest points which is visually more normal for end users than the Manhattan distance which forms a rhombus and reaches far distances in only one dimension.
me
- a mouse event fired on this component.
MouseEvent
to the given mouse event's
screen coordinates or null
if the chart is empty.public IPointFinder getPointFinder()
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
JComponent.getPreferredSize()
public java.awt.Dimension getSize()
getSize
in class java.awt.Component
Component.getSize()
public final Chart2D getSynchronizedXStartChart()
getXChartStart()
).
This feature is used to allow two separate charts to be painted stacked in y dimension (one below the other) that have different x start coordinates (because of different y labels that shift that value) with an equal starting x value (thus be comparable visually if their x values match).
getXChartStart()
).public final java.lang.String getToolTipText(java.awt.event.MouseEvent event)
getToolTipText
in class javax.swing.JComponent
JComponent.getToolTipText(java.awt.event.MouseEvent)
public IToolTipType getToolTipType()
Chart2D.ToolTipType.DATAVALUES
,
Chart2D.ToolTipType.NONE
,
Chart2D.ToolTipType.PIXEL
,
Chart2D.ToolTipType.VALUE_SNAP_TO_TRACEPOINTS
public ITracePointProvider getTracePointProvider()
public final java.util.SortedSet<ITrace2D> getTraces()
The instances are collected from all underlying axes. The resulting
is not an original set. Therefore modification methods like
Set
or Set.add(Object)
will not have any effect on the setup of this chart.
Set.clear()
public int getWidth()
getWidth
in class javax.swing.JComponent
JComponent.getWidth()
public final int getXAxisWidth()
public final int getXChartEnd()
public final int getXChartStart()
public final int getYChartEnd()
Pixel coordinates in awt / swing start from top and increase towards the bottom.
public int getYChartStart()
Pixel coordinates in awt / swing start from top and increase towards the bottom.
public boolean isEnabledPointHighlighting()
public final boolean isPaintLabels()
protected boolean isRequestedRepaint()
public final boolean isToolTipCoords()
public final boolean isUseAntialiasing()
public boolean isVisible(ITracePoint2D point)
If the point is null false will be returned.
This only works if the point argument has been scaled already.
point
- the point to test.
public final java.util.Iterator<ITrace2D> iterator()
Iterator
over the contained ITrace2D
instances.
iterator
in interface java.lang.Iterable<ITrace2D>
Iterator
over the contained ITrace2D
instances.public void paint(java.awt.Graphics g)
Component.getTreeLock()
just as it has to be done in that order in
addTrace(ITrace2D, IAxis, IAxis)
.
More info: This lock is needed to ensure a lock on the tree is acquired before a lock to the chart. Method addTrace has a code path that might descend into ChartPanel where Container.getComponents() (in method containsTraceLabel()) will require the tree lock after having already acquired the chart lock -> deadlock between paint thread and addTrace thread when using ChartPanel.
paint
in class javax.swing.JComponent
JComponent.paint(java.awt.Graphics)
protected void paintComponent(java.awt.Graphics g)
JComponent.paintComponent(java.awt.Graphics)
for details.
If you do invoke this method you may encounter performance issues, flickering UI and even deadlocks.
paintComponent
in class javax.swing.JComponent
g
- the graphics context to use.public int print(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex) throws java.awt.print.PrinterException
print
in interface java.awt.print.Printable
java.awt.print.PrinterException
Printable.print(java.awt.Graphics,
java.awt.print.PageFormat, int)
public void propertyChange(java.beans.PropertyChangeEvent evt)
PropertyChangeEvent
from all instances
the chart registers itself as a PropertyChangeListener
.
propertyChange
in interface java.beans.PropertyChangeListener
evt
- the property change event that was fired.PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)
public java.util.Set<ITrace2D> removeAllTraces()
This method is broken down to every axis contained in the trace and will
fire a
for the
PropertyChangeEvent
PropertyChangeEvent.getPropertyName()
for every single trace
removed to IAxis.PROPERTY_ADD_REMOVE_TRACE
of the corresponding
axes.
PropertyChangeListener
public boolean removeAxisXBottom(IAxis<?> axisX)
The given axis should be contained before or false will be returned.
axisX
- the bottom x axis to remove.
public boolean removeAxisXTop(IAxis<?> axisX)
The given axis should be contained before or false will be returned.
axisX
- the top x axis to remove.
public boolean removeAxisYLeft(IAxis<?> axisY)
The given axis should be contained before or false will be returned.
axisY
- the left y axis to remove.
public boolean removeAxisYRight(IAxis<?> axisY)
The given axis should be contained before or false will be returned.
axisY
- the right y axis to remove.
public final boolean removeTrace(ITrace2D points)
Chart2D
if it is
contained.
This method will trigger a PropertyChangeEvent
being
fired on all instances registered by
Container.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
(registered with String
argument
IAxis.PROPERTY_ADD_REMOVE_TRACE
on the internal axes).
points
- the trace to remove.
IAxis.PROPERTY_ADD_REMOVE_TRACE
@Deprecated public void repaint()
setRequestedRepaint(boolean)
.
repaint
in class java.awt.Component
Component.repaint()
@Deprecated public void repaint(int x, int y, int width, int height)
setRequestedRepaint(boolean)
.
repaint
in class java.awt.Component
Component.repaint(int, int, int, int)
@Deprecated public void repaint(long tm)
setRequestedRepaint(boolean)
.
repaint
in class java.awt.Component
Component.repaint(long)
@Deprecated public void repaint(long tm, int x, int y, int width, int height)
setRequestedRepaint(boolean)
.
repaint
in class javax.swing.JComponent
JComponent.repaint(long, int, int, int, int)
@Deprecated public void repaint(java.awt.Rectangle r)
setRequestedRepaint(boolean)
.
repaint
in class javax.swing.JComponent
JComponent.repaint(java.awt.Rectangle)
public void resetPrintMode()
Chart2DActionPrintSingleton
.
public void setAxisTickPainter(IAxisTickPainter tickPainter)
tickPainter
- The axis tick painter to set.@Deprecated public java.util.List<IAxis<?>> setAxisX(AAxis<?> axisX)
setAxisXBottom(AAxis, int)
instead.
This is compatibility support for the API of jchart2d prior to 3.0.0 where only one x axis was supported.
axisX
- the first bottom x axis to use.
IAxis
instance that was used at position 0.setAxisXBottom(AAxis, int)
public IAxis<?> setAxisXBottom(AAxis<?> axisX, int position)
This method delegates to
and
also uses addAxisXBottom(AAxis)
in case a bottom x
axis was configured at the position. So the events
removeAxisXBottom(IAxis)
will be fired for remove and
add.
PROPERTY_AXIS_X
Furthermore this method uses "replace - semantics". The
instances contained in the previous x bottom
axis will be implanted to this new axis. Also the title and stuff like grid
settings will be transferred. For this an event with property
ITrace2D
is fired.
PROPERTY_AXIS_X_BOTTOM_REPLACE
Note that
of the axis will not be
transferred silently to the new axis but have to handle their unregistering
from the old axis / registering to the new axis from outside to give them
the chance to manage their state transitions by themselves.PropertyChangeListener
s
Before the state of the old axis is transferred they will receive
with PropertyChangeListener.propertyChange(PropertyChangeEvent)
as code
and the old and new axis as values and have the change to change their peer
to listen on thus receiving the change events generated on the new axis. At
the moment the replace event is sent they will already have received the
event PROPERTY_AXIS_X_BOTTOM_REPLACE
event for the removal:
So be careful not to react on that first event by removing your listener
from the axis as you then will not receive the replace event!
PROPERTY_AXIS_X
axisX
- the first bottom x axis to use.position
- the index of the axis on bottom x dimension (starting from 0).
public IAxis<?> setAxisXTop(AAxis<?> axisX, int position)
This method delegates to
and
also uses addAxisXBottom(AAxis)
in case a top x
axis was configured on the position. So the events
removeAxisXBottom(IAxis)
will be fired for remove and
add.
PROPERTY_AXIS_X
Furthermore this method uses "replace - semantics". The
instances contained in the previous x top
axis will be implanted to this new axis. Also the title and stuff like grid
settings will be transferred. For this an event with property
ITrace2D
is fired.
PROPERTY_AXIS_Y_LEFT_REPLACE
Note that
of the axis will not be
transferred silently to the new axis but have to handle their unregistering
from the old axis / registering to the new axis from outside to give them
the chance to manage their state transitions by themselves.PropertyChangeListener
s
Before the state of the old axis is transferred they will receive
with PropertyChangeListener.propertyChange(PropertyChangeEvent)
as code and
the old and new axis as values and have the change to change their peer to
listen on thus receiving the change events generated on the new axis. At
the moment the replace event is sent they will already have received the
event PROPERTY_AXIS_X_TOP_REPLACE
event for the removal:
So be careful not to react on that first event by removing your listener
from the axis as you then will not receive the replace event!
PROPERTY_AXIS_X
axisX
- the top x axis to use.position
- the index of the axis on top x dimension (starting from 0).
@Deprecated public java.util.List<IAxis<?>> setAxisY(AAxis<?> axisY)
setAxisYLeft(AAxis, int)
instead.
This is compatibility support for the API of jchart2d prior to 3.0.0 where only one y axis was supported.
axisY
- the first left y axis to use.
AAxis
instance that was used at position 0.setAxisYLeft(AAxis, int)
public IAxis<?> setAxisYLeft(AAxis<?> axisY, int position)
This method delegates to
and also
uses addAxisYLeft(AAxis)
in case an axis was
configured on the position. So the events
removeAxisYLeft(IAxis)
will be fired for remove and
add.
PROPERTY_AXIS_Y
Furthermore this method uses "replace - semantics". The
instances contained in the previous left y
axis will be implanted to this new axis. Also the title and stuff like grid
settings will be transferred. For this an event with property
ITrace2D
is fired.
PROPERTY_AXIS_Y_LEFT_REPLACE
Note that
of the axis will not be
transferred silently to the new axis but have to handle their unregistering
from the old axis / registering to the new axis from outside to give them
the chance to manage their state transitions by themselves.PropertyChangeListener
s
Before the state of the old axis is transferred they will receive
with PropertyChangeListener.propertyChange(PropertyChangeEvent)
as code and
the old and new axis as values and have the change to change their peer to
listen on thus receiving the change events generated on the new axis. At
the moment the replace event is sent they will already have received the
event PROPERTY_AXIS_Y_LEFT_REPLACE
event for the removal:
So be careful not to react on that first event by removing your listener
from the axis as you then will not receive the replace event!
PROPERTY_AXIS_Y
axisY
- the left y axis to use.position
- the index of the axis on left y dimension (starting from 0).
public IAxis<?> setAxisYRight(AAxis<?> axisY, int position)
This method delegates to
and
also uses addAxisYRight(AAxis)
in case an axis was
configured on the position. So the events
removeAxisYRight(IAxis)
will be fired for remove and
add.
PROPERTY_AXIS_Y
Furthermore this method uses "replace - semantics". The
instances contained in the previous right y
axis will be implanted to this new axis. Also the title and stuff like grid
settings will be transferred. For this an event with property
ITrace2D
is fired.
PROPERTY_AXIS_Y_RIGHT_REPLACE
Note that
of the axis will not be
transferred silently to the new axis but have to handle their unregistering
from the old axis / registering to the new axis from outside to give them
the chance to manage their state transitions by themselves.PropertyChangeListener
s
Before the state of the old axis is transferred they will receive
with PropertyChangeListener.propertyChange(PropertyChangeEvent)
as code and
the old and new axis as values and have the change to change their peer to
listen on thus receiving the change events generated on the new axis. At
the moment the replace event is sent they will already have received the
event PROPERTY_AXIS_Y_RIGHT_REPLACE
event for the removal:
So be careful not to react on that first event by removing your listener
from the axis as you then will not receive the replace event!
PROPERTY_AXIS_Y
axisY
- the right y axis to use.position
- the index of the axis on right y dimension (starting from 0).
public final void setGridColor(java.awt.Color gridclr)
gridclr
- the grid color to use.public void setMinPaintLatency(int minPaintLatency)
minPaintLatency
- the setting for the ms to give a repaint operation time for
collecting several repaint requests into one (performance vs.
update speed).public void setPaintLabels(boolean paintLabels)
paintLabels
- the value for paintLabels to set.public void setPointFinder(IPointFinder pointFinder)
pointFinder
- the point finder used to find the nearest point corresponding to a
mouse event.Chart2D.PointFinder.MANHATTAN
,
Chart2D.PointFinder.EUCLID
public final void setRequestedRepaint(boolean requestedRepaint)
Internal method to request a repaint that guarantees that two invocations
of will always have at least have an interval of
ms.
getMinPaintLatency()
Methods
must not be
called from application code that has to inform the UI to update the chart
directly or a performance problem may arise as java awt / swing
implementation does not guarantee to collapse several repaint requests into
a single one but prefers to issue many paint invocations causing a high CPU
load in realtime scenarios (adding several 100 points per second to a
chart).
repaint()
, repaint(long)
,
repaint(Rectangle)
, repaint(int, int, int, int)
and repaint(long, int, int, int, int)
Only the internal timer may invoke the methods mentioned above.
requestedRepaint
- the requestedRepaint to set.public void setSynchronizedXStartChart(Chart2D synchronizedXStartChart)
getXChartStart()
).
This feature is used to allow two separate charts to be painted stacked in y dimension (one below the other) that have different x start coordinates (because of different y labels that shift that value) with an equal starting x value (thus be comparable visually if their x values match).
synchronizedXStartChart
- the chart that will be synchronized for finding the start
coordinate of this chart to draw in x dimension (
getXChartStart()
).@Deprecated public final void setToolTipCoords(boolean toolTipCoords)
setToolTipType(IToolTipType)
with
Chart2D.ToolTipType.DATAVALUES
instead.
This turns on tool tip support (like
JComponent.setToolTipText(java.lang.String)
) if
neccessary.
toolTipCoords
- The toolTipCoords to set.public final void setToolTipType(IToolTipType toolTipType)
Use
to turn of tool tips.
Chart2D.ToolTipType.NONE
toolTipType
- one of the available Chart2D.ToolTipType
constants.Chart2D.ToolTipType.DATAVALUES
,
Chart2D.ToolTipType.NONE
,
Chart2D.ToolTipType.PIXEL
,
Chart2D.ToolTipType.VALUE_SNAP_TO_TRACEPOINTS
public void setTracePointProvider(ITracePointProvider tracePointProvider)
Null assignment attempts will raise an
.
AssertionError
tracePointProvider
- the trace point creator of this chart to set.public final void setUseAntialiasing(boolean useAntialiasing)
useAntialiasing
- true if antialiasing should be used.public java.awt.image.BufferedImage snapShot()
ImageIO.write(java.awt.image.RenderedImage, java.lang.String, java.io.File)
.
If the width and height of this chart is zero (this happens when the chart
has not been JComponent.setVisible(boolean)
, the chart
was not integrated into layout correctly or the chart's dimenision was set
to this value, a default of width 600 and height 400 will temporarily be
set (syncrhonized), the image will be rendered, the old dimension will be
reset and the image will be returned.
If you want to paint offscreen images (without displayed chart) prefer
invoke snapShot(int, int)
instead.
public java.awt.image.BufferedImage snapShot(int width, int height)
ImageIO.write(java.awt.image.RenderedImage, java.lang.String, java.io.File)
.
width
- the width of the image to create.height
- the height of the image to create.
public java.lang.String toString()
toString
in class java.awt.Component
Object.toString()
@Deprecated public ITracePoint2D translateMousePosition(java.awt.event.MouseEvent mouseEvent) throws java.lang.IllegalArgumentException
Note that the mouse event has to be an event fired on this component!
Note that the returned tracepoint is not a real trace point of a trace but just used as a container here.
mouseEvent
- a mouse event that has been fired on this component.
java.lang.IllegalArgumentException
- if the given mouse event does not belong to this component.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |