Class XYGraph
java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.nebula.visualization.xygraph.figures.XYGraph
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
,IXYGraph
public class XYGraph extends org.eclipse.draw2d.Figure implements IXYGraph
This class is the main figure for the plotting. It contains a PlotArea, which
contains a space to plot traces, and the axes, title and legend of the graph.
XY-Graph Figure.
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static org.eclipse.swt.graphics.RGB[]
DEFAULT_TRACES_COLOR
Default colors for newly added item, used over when reaching the end.protected java.util.Map<Axis,Legend>
legendMap
protected OperationsManager
operationsManager
protected PlotArea
plotArea
Axis
primaryXAxis
Deprecated.Axis
primaryYAxis
Deprecated.static java.lang.String
PROPERTY_CONFIG
Deprecated.static java.lang.String
PROPERTY_XY_GRAPH_MEM
Deprecated.static java.lang.String
PROPERTY_ZOOMTYPE
Deprecated.protected org.eclipse.draw2d.Label
titleLabel
protected boolean
transparent
protected java.util.List<Axis>
xAxisList
protected java.util.List<Axis>
yAxisList
-
Constructor Summary
Constructors Constructor Description XYGraph()
ConstructorXYGraph(IAxesFactory axesFactory)
Constructor. -
Method Summary
Modifier and Type Method Description void
addAnnotation(Annotation annotation)
Add an annotationvoid
addAxis(Axis axis)
Add an axis to the graphvoid
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
void
addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
void
addTrace(Trace trace)
Add a traceprotected PlotArea
createPlotArea(IXYGraph xyGraph)
Warning: This method is called in the constructor to create a plot areavoid
fireConfigChanged()
java.util.List<Axis>
getAxisList()
org.eclipse.swt.graphics.Image
getImage()
org.eclipse.swt.graphics.Image
getImage(org.eclipse.swt.graphics.Rectangle size)
Legend
getLegend(Trace trace)
java.util.Map<Axis,Legend>
getLegendMap()
OperationsManager
getOperationsManager()
PlotArea
getPlotArea()
Axis
getPrimaryXAxis()
Axis
getPrimaryYAxis()
java.lang.String
getTitle()
org.eclipse.swt.graphics.Color
getTitleColor()
org.eclipse.swt.graphics.RGB
getTitleColorRgb()
org.eclipse.swt.graphics.Font
getTitleFont()
org.eclipse.swt.graphics.FontData
getTitleFontData()
java.util.List<Axis>
getXAxisList()
XYGraphMemento
getXyGraphMem()
java.util.List<Axis>
getYAxisList()
ZoomType
getZoomType()
boolean
isOpaque()
boolean
isShowLegend()
boolean
isShowTitle()
boolean
isTransparent()
protected void
layout()
void
paintFigure(org.eclipse.draw2d.Graphics graphics)
void
performAutoScale()
Perform forced autoscale to all axes.void
performStagger()
Stagger all axes: Autoscale each axis so that traces on various axes don't overlapvoid
removeAnnotation(Annotation annotation)
Remove an annotationboolean
removeAxis(Axis axis)
Remove an axis from the graphvoid
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
void
removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
void
removeTrace(Trace trace)
Remove a trace.void
setShowLegend(boolean showLegend)
void
setShowTitle(boolean showTitle)
void
setTitle(java.lang.String title)
void
setTitleColor(org.eclipse.swt.graphics.Color titleColor)
void
setTitleFont(org.eclipse.swt.graphics.Font titleFont)
void
setTransparent(boolean transparent)
void
setXyGraphMem(XYGraphMemento xyGraphMem)
void
setZoomType(ZoomType zoomType)
Methods inherited from class org.eclipse.draw2d.Figure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, paint, paintBorder, paintChildren, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.draw2d.IFigure
add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addMouseListener, addMouseMotionListener, addNotify, containsPoint, containsPoint, erase, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFont, getForegroundColor, getInsets, getLayoutManager, getLocalBackgroundColor, getLocalForegroundColor, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isRequestFocusEnabled, isShowing, isVisible, paint, remove, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeMouseListener, removeMouseMotionListener, removeNotify, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setClippingStrategy, setConstraint, setCursor, setEnabled, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, validate
-
Field Details
-
PROPERTY_CONFIG
@Deprecated public static final java.lang.String PROPERTY_CONFIGDeprecated.UseIXYGraph.PROPERTY_CONFIG
instead- See Also:
- Constant Field Values
-
PROPERTY_XY_GRAPH_MEM
@Deprecated public static final java.lang.String PROPERTY_XY_GRAPH_MEMDeprecated.UseIXYGraph.PROPERTY_XY_GRAPH_MEM
instead- See Also:
- Constant Field Values
-
PROPERTY_ZOOMTYPE
@Deprecated public static final java.lang.String PROPERTY_ZOOMTYPEDeprecated.UseIXYGraph.PROPERTY_ZOOMTYPE
instead- See Also:
- Constant Field Values
-
DEFAULT_TRACES_COLOR
public static final org.eclipse.swt.graphics.RGB[] DEFAULT_TRACES_COLORDefault colors for newly added item, used over when reaching the end.Very hard to find a long list of distinct colors. This list is definitely too short...
-
transparent
protected boolean transparent -
legendMap
-
titleLabel
protected org.eclipse.draw2d.Label titleLabel -
xAxisList
-
yAxisList
-
plotArea
-
primaryXAxis
Deprecated.UsegetPrimaryXAxis()
instead -
primaryYAxis
Deprecated.UsegetPrimaryYAxis()
instead -
operationsManager
-
-
Constructor Details
-
XYGraph
public XYGraph()Constructor -
XYGraph
Constructor.- Parameters:
axesFactory
- TheIAxesFactory
to use to create the primary axes for the graph. Should not benull
-
-
Method Details
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)- Specified by:
addPropertyChangeListener
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
addPropertyChangeListener
in classorg.eclipse.draw2d.Figure
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)- Specified by:
addPropertyChangeListener
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
addPropertyChangeListener
in classorg.eclipse.draw2d.Figure
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)- Specified by:
removePropertyChangeListener
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
removePropertyChangeListener
in classorg.eclipse.draw2d.Figure
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)- Specified by:
removePropertyChangeListener
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
removePropertyChangeListener
in classorg.eclipse.draw2d.Figure
-
fireConfigChanged
public void fireConfigChanged()- Specified by:
fireConfigChanged
in interfaceIXYGraph
-
getXyGraphMem
- Specified by:
getXyGraphMem
in interfaceIXYGraph
-
setXyGraphMem
- Specified by:
setXyGraphMem
in interfaceIXYGraph
-
createPlotArea
Warning: This method is called in the constructor to create a plot area- Parameters:
xyGraph
-- Returns:
- a plotArea
-
isOpaque
public boolean isOpaque()- Specified by:
isOpaque
in interfaceorg.eclipse.draw2d.IFigure
- Overrides:
isOpaque
in classorg.eclipse.draw2d.Figure
-
layout
protected void layout()- Overrides:
layout
in classorg.eclipse.draw2d.Figure
-
setZoomType
- Specified by:
setZoomType
in interfaceIXYGraph
- Parameters:
zoomType
- the zoomType to set
-
getZoomType
- Specified by:
getZoomType
in interfaceIXYGraph
- Returns:
- the zoomType
-
setTitle
public void setTitle(java.lang.String title) -
setShowTitle
public void setShowTitle(boolean showTitle)- Specified by:
setShowTitle
in interfaceIXYGraph
- Parameters:
showTitle
- true if title should be shown; false otherwise.
-
isShowTitle
public boolean isShowTitle()- Specified by:
isShowTitle
in interfaceIXYGraph
- Returns:
- true if title should be shown; false otherwise.
-
setShowLegend
public void setShowLegend(boolean showLegend)- Specified by:
setShowLegend
in interfaceIXYGraph
- Parameters:
showLegend
- true if legend should be shown; false otherwise.
-
isShowLegend
public boolean isShowLegend()- Specified by:
isShowLegend
in interfaceIXYGraph
- Returns:
- the showLegend
-
addAxis
Add an axis to the graph -
removeAxis
Remove an axis from the graph- Specified by:
removeAxis
in interfaceIXYGraph
- Parameters:
axis
-- Returns:
- true if this axis exists.
-
addTrace
Add a trace -
removeTrace
Remove a trace.- Specified by:
removeTrace
in interfaceIXYGraph
- Parameters:
trace
-
-
addAnnotation
Add an annotation- Specified by:
addAnnotation
in interfaceIXYGraph
- Parameters:
annotation
-
-
removeAnnotation
Remove an annotation- Specified by:
removeAnnotation
in interfaceIXYGraph
- Parameters:
annotation
-
-
setTitleFont
public void setTitleFont(org.eclipse.swt.graphics.Font titleFont)- Specified by:
setTitleFont
in interfaceIXYGraph
- Parameters:
titleFont
- the titleFont to set
-
getTitleFont
public org.eclipse.swt.graphics.Font getTitleFont()- Specified by:
getTitleFont
in interfaceIXYGraph
- Returns:
- the title font.
-
getTitleFontData
public org.eclipse.swt.graphics.FontData getTitleFontData()- Specified by:
getTitleFontData
in interfaceIXYGraph
-
setTitleColor
public void setTitleColor(org.eclipse.swt.graphics.Color titleColor)- Specified by:
setTitleColor
in interfaceIXYGraph
- Parameters:
titleColor
- the titleColor to set
-
paintFigure
public void paintFigure(org.eclipse.draw2d.Graphics graphics)- Specified by:
paintFigure
in interfaceIXYGraph
- Overrides:
paintFigure
in classorg.eclipse.draw2d.Figure
-
setTransparent
public void setTransparent(boolean transparent)- Specified by:
setTransparent
in interfaceIXYGraph
- Parameters:
transparent
- the transparent to set
-
isTransparent
public boolean isTransparent()- Specified by:
isTransparent
in interfaceIXYGraph
- Returns:
- the transparent
-
getPlotArea
- Specified by:
getPlotArea
in interfaceIXYGraph
- Returns:
- the plotArea, which contains all the elements drawn inside it.
-
getImage
public org.eclipse.swt.graphics.Image getImage() -
getTitleColor
public org.eclipse.swt.graphics.Color getTitleColor()- Specified by:
getTitleColor
in interfaceIXYGraph
- Returns:
- the titleColor
-
getTitleColorRgb
public org.eclipse.swt.graphics.RGB getTitleColorRgb()- Specified by:
getTitleColorRgb
in interfaceIXYGraph
-
getTitle
public java.lang.String getTitle() -
getOperationsManager
- Specified by:
getOperationsManager
in interfaceIXYGraph
- Returns:
- the operationsManager
-
getXAxisList
- Specified by:
getXAxisList
in interfaceIXYGraph
- Returns:
- the xAxisList
-
getYAxisList
- Specified by:
getYAxisList
in interfaceIXYGraph
- Returns:
- the yAxisList
-
getAxisList
- Specified by:
getAxisList
in interfaceIXYGraph
- Returns:
- the all the axis include xAxes and yAxes. yAxisList is appended to xAxisList in the returned list.
-
getLegend
-
getLegendMap
- Specified by:
getLegendMap
in interfaceIXYGraph
- Returns:
- the legendMap
-
performAutoScale
public void performAutoScale()Perform forced autoscale to all axes.- Specified by:
performAutoScale
in interfaceIXYGraph
-
performStagger
public void performStagger()Stagger all axes: Autoscale each axis so that traces on various axes don't overlap- Specified by:
performStagger
in interfaceIXYGraph
-
getImage
public org.eclipse.swt.graphics.Image getImage(org.eclipse.swt.graphics.Rectangle size)- Parameters:
trim
- a SWT Rectangle- Returns:
- Image of the XYFigure. Receiver must dispose.
-
getPrimaryXAxis
- Specified by:
getPrimaryXAxis
in interfaceIXYGraph
-
getPrimaryYAxis
- Specified by:
getPrimaryYAxis
in interfaceIXYGraph
-